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

Remove Random String...

Explorer ,
Apr 10, 2008 Apr 10, 2008
I need to find a sting in a block of text and remove it... How is this done?

For instance my text would be:
The quick brown fox jumped over the lazy dog.

I want to remove:
"quick brown fox" from that string...

Here is the catch, the string I want to remove will always start with "quick" and end with "fox", but "brown" may be blue, it may be green, it may be ugly, it may be anything... So in someway I need to have a script that looks for "quick" and looks for "fox" and remove those words and anything inbetween...

How is that done?

Thanks!!!
305
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
Contributor ,
Apr 10, 2008 Apr 10, 2008
Bweno,

I'd probably use ColdFusion's REReplace() function (which requires understanding regular expression syntax), but you could also find the point at which "quick" ends and "fox" begins and use the RemoveChars() function to remove everything between the two.
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 ,
Apr 10, 2008 Apr 10, 2008
LATEST
bweno wrote:
>
> How is that done?
>
> Thanks!!!
>

Regular expression is how this can be done.

There is a lot to learn about regex, a simple example form you question:

<cfset stuff = refind("quick.+brown","The quick brown fox jumped over
the lazy dog.")>
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