Coldfusion Knob
I have a HUGE line list(I will limit the example to one line) in the format:
"[First Name] [Last Name] <[email address]>"
I ran a regular expression in a string to split this into an array.
<cfset x = REMatch("<(.*?)>",list) />
This works fine except that it also returns angular brackets <>around the email address
x[1] = <[email address]>
Just for simplicity, because cfdocs are rather ambiguous, I wrote this loop to remove the first and last characters of each index.
<cfloop from="1" to="#arrayLen(x)#" index="y">
<cfset a = #RemoveChars(x[y], 1, 1)# />
<cfset a = #left(a,len(a)-1)# />
<cfset x[y] = a />
</cfloop>
This works fine, yay, now I have an array.
However, this is not what I wanted. How can I return the email address WITHOUT the angular brackets included first?
(Note that I also tried REReplaceand REFindonly returns the index of the event)
( , [], , , )
Coldfusion (Apache ORO, . ), lookbehind, .
:
<cfset x = REMatch("[^<>]+(?=>)",list) />
, .
:
[^<>]+ # Match one or more characters except angle brackets
(?=>) # Make sure the next character is a closing angle bracket