0

I cant get my regexpression to work in php. It works in javascript (vuejs):

(?<=.+: )(.*)

I have this string:

NL: abcdef

and i would like to get

abcdef

Can someone please tell me what i am doing wrong?

Ernst Reidinga
  • 203
  • 2
  • 13

1 Answers1

0

There are many ways to solve this using PHP/PCRE, one is to skip the preceding string using \K

[^:]+: \K(.*)

Regex Demo

If you can add an anchor to the beginning of the string, even better: ^[^:]+: \K(.*)

wp78de
  • 18,207
  • 7
  • 43
  • 71
  • 1
    BTW: You said you used `(?<=.+: )(.*)` in JavaScript. However, this only works in Chrome v62+ (i.e. browsers supporting ECMA2018) but not in other major browsers because the lookbehind is not available in many JS' Regex flavor. – wp78de Oct 18 '18 at 23:51