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

Regular Expressions

Guest
Feb 15, 2009 Feb 15, 2009
I have a search application where a user can input search strings into a text box and submit.

If the user enters for example: website "content approval" new

What would the regular expression be to extract the 3 words:
1) website
2) content approval
3) new

There are also other scenarios that a user can enter, so it will need to work for all cases.
223
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
Explorer ,
Feb 15, 2009 Feb 15, 2009
LATEST
If you want to match the three words in other words any of them.
split the string and create a regex for each word the i flag will set an ignore case, the g flag will get all matches, consider creating one for the three words together and prioritize it in the results as one is likely to prefer a full match and then any other match. the general syntax would be
/website/gi;
/new/gi;
/content approval/gi;
i am unsure about the syntax specific for the use of regex with CF. But it should be something like that since it is java based.
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