regex

M

Michael G

I want to match mailto:[email protected] in a string that contains many
similar patterns.

I used "mailto:(.[^"]*)" to match each "mailto: ..." string. The parans
then allowed me to get at the email address.

But now I realize I need more info from each match.
I need to extend the match to the first 'gif' (the characters 'gif' would be
the end of the string instead of ' " ' as in my first regex.) but I am
having some trouble doing so.

I have tried a number of different combinations but without the match I
need.

I know what I need. I need to do as I did in the example above except I
need to not include a group of characters instead of just one.

Thanks, Mike
 
M

Michael G

Michael G said:
I want to match mailto:[email protected] in a string that contains many
similar patterns.

I used "mailto:(.[^"]*)" to match each "mailto: ..." string. The parans
then allowed me to get at the email address.

But now I realize I need more info from each match.
I need to extend the match to the first 'gif' (the characters 'gif' would be
the end of the string instead of ' " ' as in my first regex.) but I am
having some trouble doing so.

I have tried a number of different combinations but without the match I
need.

I know what I need. I need to do as I did in the example above except I
need to not include a group of characters instead of just one.

Thanks, Mike

this works

"mailto:(.[^"]*)".*gif"{1}
 
M

Michael G

no regex experts?
I am surprised that no one responded. I did finally figure it out.

/"mailto:(.[^"]*)".*?gif/i



Michael G said:
I want to match mailto:[email protected] in a string that contains many
similar patterns.

I used "mailto:(.[^"]*)" to match each "mailto: ..." string. The parans
then allowed me to get at the email address.

But now I realize I need more info from each match.
I need to extend the match to the first 'gif' (the characters 'gif' would be
the end of the string instead of ' " ' as in my first regex.) but I am
having some trouble doing so.

I have tried a number of different combinations but without the match I
need.

I know what I need. I need to do as I did in the example above except I
need to not include a group of characters instead of just one.

Thanks, Mike
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top