![]() |
![]() |
#1 | ||
Bemusing Prompter
"Danny"
Dec 2002
California
5·499 Posts |
![]()
I'm having a bit of trouble with regular expressions in R.
I know the following regular expression Code:
'^.*([-A-Za-z0-9_.%]+@[-A-Za-z0-9_.%]+\\.[A-Za-z]+).*$' However, Quote:
Quote:
Thanks. |
||
![]() |
![]() |
![]() |
#2 |
"William"
May 2003
Near Grandkid
45058 Posts |
![]()
I've run into different definitions of regular expressions from time to time. But assuming your situation is like described here:
http://www.regular-expressions.info/reference.html your problem is the the first ".*" is greedy, trying the longest possible matches first. I think you need to make it lazy, changing the .* to .*? Code:
emailpat = '^.*?([-A-Za-z0-9_.%]+@[-A-Za-z0-9_.%]+\\.[A-Za-z]+).*$' Code:
emailpat = '^.*[^-A-Za-z0-9_.%]([-A-Za-z0-9_.%]+@[-A-Za-z0-9_.%]+\\.[A-Za-z]+).*$' William |
![]() |
![]() |
![]() |
#3 |
Bemusing Prompter
"Danny"
Dec 2002
California
5·499 Posts |
![]()
The first one didn't work but the second did. Thanks so much!
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
The Expanse has to be the most epic 45 minutes to get a first showing on regular cable. | jasong | jasong | 25 | 2016-01-21 16:03 |
meaning of regular flashes of hot lead | wildrabbitt | Hardware | 8 | 2015-06-22 10:29 |
Regular polygon: ruler & compass possible only if | Raman | Puzzles | 21 | 2009-12-09 20:25 |
Regular expressions (or DFA?) | CRGreathouse | Math | 3 | 2009-12-09 19:56 |
Using regular Prime 95 on 64 bit windows? | Speedbump | Information & Answers | 1 | 2009-07-25 00:51 |