Jump to content

StringReplace - From - XXXXXXX - To


Recommended Posts

Hey guys.

i need a quick help in the Function StringReplace..

I have a String that contains several substrings.

every substring contains a number, which are the first 3 letters of the substring.

Then there are some more letters... and finally a " | "

I want to Replace the number until the " | "

So this:

"323)(XXXXXXXXXXXXXXXXX|"

becomes This:

""

Could anyone help?

Link to comment
Share on other sites

Take a look at StringRegExpReplace, but I'm not into regular expressions, so sorry I can't give you an example. :graduated:

I'm sure you can find a lot of regex ressources on the forum or the web.

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

$checkks = 'test\test?test*323)(XXXXXXXXXXXXXXXXX|"test&test|test/'
$REPL = StringRegExpReplace($checkks, '\d{3}.*?\|', '')
MsgBox(0, '', $REPL)

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Code-Mega,

I dont get the "test"s and "?"s in your code...

And the real strings arent "XXXXXXXXXXXX"

it could be everything..

Replacing a known string is not what i asked

Or i just don't get what you want to tell me :graduated:

#EDIT

Ah sorry, youre right!!!

Thank you!

Edited by jWalker
Link to comment
Share on other sites

Just try it out. It is variable. Change the XXXX with something eles.

The command looks into the given string for 3 numbers then after that all until a | appears and then replaces it with nothing.

If that is not what you wanted, then show me some examples of

before and after and then I can create the correct pattern for that.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...