-2

I was trying to solve this by myself but there are only solutions for cases like that:

"text" "text2" "text3"

I need to write a pattern which takes strings starting with '-' sign, expected result is shown below:

Input:

-something/3443/kk-somethingelse/111/333/zz
-text/ff/33/33/zz

Output:

1. something/3443/kk
2. somethingelse/111/333/zz
3. text/ff/33/33/zz

as individual grups.

Thanks in advance and sorry I couldnt manage that.

piess105
  • 65
  • 1
  • 5

2 Answers2

1

Try this pattern, with global flag:

-([^-\s]+)

Demo link

hjpotter92
  • 71,576
  • 32
  • 131
  • 164
0

I would exclude line breaks as well:

-([^-\r\n]+)
Giorgi Nakeuri
  • 33,698
  • 8
  • 33
  • 67