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

Regular expression question

LEGEND ,
Aug 01, 2008 Aug 01, 2008
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
250
Translate
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
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
>
>
>


Translate
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