• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Regular expression question

LEGEND ,
Aug 01, 2008 Aug 01, 2008

Copy link to clipboard

Copied

Hi All,
I want to take out a part of text from a string. Like
"This is a sample of regular expression ok message sample ok dude"
Result should be "This is a message sample ok dude"
I try this
<cfset temp = "This is a sample of regular expression ok message sample ok"
<cfset temp1 = #REReplace(temp, '(sample).*(ok)',"")#>

But it deletes until the last "ok" like "This is a dude"
Can anyone help?
Thanks

JFB


TOPICS
Advanced techniques

Views

233

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 01, 2008 Aug 01, 2008

Copy link to clipboard

Copied

LATEST
Sometime I need to write to see the solution.
I got it.
<cfset temp1 = #REReplace(temp, '(sample).+?(ok)',"")#>

Is this a good solution?
Thanks

JFB



"JFB" <jfb@help.com> wrote in message
news:g6vskv$lnl$1@forums.macromedia.com...
> Hi All,
> I want to take out a part of text from a string. Like
> "This is a sample of regular expression ok message sample ok dude"
> Result should be "This is a message sample ok dude"
> I try this
> <cfset temp = "This is a sample of regular expression ok message sample
> ok"
> <cfset temp1 = #REReplace(temp, '(sample).*(ok)',"")#>
>
> But it deletes until the last "ok" like "This is a dude"
> Can anyone help?
> Thanks
>
> JFB
>
>
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation