Input data:

link /? param = value
link /
link / section /

Weekends:

link

How to get everything before a slash (replacement expression) with a regular?

Added a third option in the input.
Trying to get this: (. +? /)
In the third case issues: link / section /

  • one
    depends on what quality to get. if the capture group is appropriate, then (.*?)/ , if complete match, then .*?(?=\/) - Mike
  • @Mike in the first case, slash forgot to screen. - de_frag pm
  • can be so ([^\/]+) - coder675
  • I'm testing: / test / link / section / Reg: ^ / test / ([^ \ /] +) / I get: linksection / - Anton Martynov

0