Question: regex to extract string coldfusion


regex to extract string coldfusion

Answers 1
Added at 2017-09-06 19:09

I have a string like below. I want to extract Fname Lname, email into two different strings using coldfusion. I've tried few things but with not much luck. Any ideas.

<cfset string = '"Fname Lname" <>' />
Answers to

regex to extract string coldfusion

nr: #1 dodano: 2017-09-06 20:09

You could try this:

<cfset string = '"Fname Lname" <>' />
<cfset tmpNameVar=mid(string,2,len(string))>
<cfset NameVar=listgetat(tmpNameVar,1,'"')>
<cfset emailVar=listgetat(tmpNameVar,2,'"')>
<cfset emailVar=replace(emailVar,"<","","ALL")>
<cfset emailVar=replace(emailVar,">","","ALL")>
name: #namevar#<BR>

You may want to turn the process into a function.

Source Show
◀ Wstecz