regex - match anything until

J

John

Hi

Let's say I have a string:

Ann ddsddfdf;,f,ef.we;r,asfdfdsff Bob dasd,@d&asdasodkasm,das Charles

=~ m |Ann([.]+)Bob([.]+)Charles|

I'm trying to extract the two strings between the 3 names.

It doesn't work. What is the construct for 'anything until the string Bob'

Regards
John
 
J

John

Tad J McClellan said:
John said:
Ann ddsddfdf;,f,ef.we;r,asfdfdsff Bob dasd,@d&asdasodkasm,das
Charles

=~ m |Ann([.]+)Bob([.]+)Charles|
^ ^ ^ ^
^ ^ ^ ^ dot is not meta when in a character class
I'm trying to extract the two strings between the 3 names.

It doesn't work.


Remove the square brackets.

What is the construct for 'anything until the string Bob'


/(.*)Bob/s

The construct for 'anything except newline until the string Bob' is:

/(.*)Bob/


Many thanks. I can see my mistake.

Regards
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top