Fast regex that matches a character but does not include that character

I want to match with P character all charters after P and between newline character.

What I've tried is "P. * \ n", which clearly still matches P, but I want all the characters after p and before the newline.

Somebody knows?

+1


source to share


4 answers


You can try this:

(?<=P).*(?!\n)

      



Positive lookbehind for P, then negative lookahead for newline.

Edited my original answer.

+3


source


just use:

p(.*)

      



make sure you are not using the multipart regex option.

+2


source


What about:

P(.*?)\n

      

The characters you want are in group 1

0


source


You may try:

P(.*?)\n

      

enter image description here

From the hero Regex

0


source







All Articles