Champak Posted November 15, 2008 Share Posted November 15, 2008 (edited) Simple problem...but can't get it. How can I use stringregexpreplace to remove a phrase within a sentence? Ex. $Test = "John went to town on monday" I want to remove "John went to town". I don't want to use any of the functions to get the count and then trim, just want to use stringregexpreplace, and it has to work with none alphanumeric and numeric characters. Thanks Edited November 15, 2008 by Champak Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 15, 2008 Share Posted November 15, 2008 Is it always going to be the same part to remove? Like is it "John went to town." "John went to town on monday." "John went to town in his new car." etc? Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Champak Posted November 15, 2008 Author Share Posted November 15, 2008 (edited) Yes, the $Test variable will always be different.....it will actually be '@ScriptDir & "\Folder\"' for my present needs. So everyones @ScriptDir will be different. And I figured I might as well ask my question in a generic way so I can apply it anytime I have the need for a similar situation. Edited November 15, 2008 by Champak Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 15, 2008 Share Posted November 15, 2008 Yes, the $Test variable will always be different.....it will actually be '@ScriptDir & "\Folder\"' for my present needs. So everyones @ScriptDir will be different. And I figured I might as well ask my question in a generic way so I can apply it anytime I have the need for a similar situation.Deleting something is just: $sString = StringRegExpReplace($sString, "RegExpHere", "")But you have to tell it what to replace (with the RegExp). If you know it will be @ScriptDir, for example, it might be easier to just do: $sString = StringReplace($sString, @ScriptDir, "") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Champak Posted November 15, 2008 Author Share Posted November 15, 2008 I can't believe I forgot about stringreplace. I was looking at everything except that like I had blinders on. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now