How to remove text after certain word
问题 I have a string The best laid schemes of mice and men How do I remove all text after the word "schemes" in ColdFusion? I suppose this can be done with regex. 回答1: Here ya go: <cfset myString = "The best laid schemes of mice and men" /> <cfoutput>#REReplace(myString, "schemes(.*)", "schemes")#</cfoutput> 回答2: Your regex is: schemes.*$ and replace with "schemes" Explanation .*$ means match any character ( . ) 0 or more times ( * ) till the end of the row ( $ ) 回答3: Try this regex: schemes(.*)