Jump to content
Sign in to follow this  
jWalker

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?

Share this post


Link to post
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]

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I got sth like this

$List = StringReplace( $List, "\"&$hSocket&".*?\|", "|" )

I have a variable... I need to cut the string from the var - until it reaches the |

So could you give me the explicit code please?

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...