Jump to content

[Solved] StringReplace and []


gimx
 Share

Recommended Posts

Hello,

I have a string with [] (bracket in english ?).

I want remove this [] but i have an error.

What's wrong plz ? :D

$text = 123[456]789

$text = StringReplace($text, "[", "")

$text = StringReplace($text, "]", "")

Thx :D

Edited by gimx
Link to comment
Share on other sites

Ok i've seen my prob.

For example, my "real" string is : 12[34]5(67)89

First, i want delete all digit between the (), the result would be : 12[34]589

And after, i want to delete the [].

I try this code but it don't work for the first case :

$text = StringRegExpReplace($text, "((.*?))", "")

Thx for help :D

Link to comment
Share on other sites

Hi,

try this:

Global $str = "12[34]5(67)89"
ConsoleWrite(StringRegExpReplace($str, '\(.*?\)|\[|\]', '') & @CRLF)

Mega

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

Aaahhh yes sorry, damn escaped char...

I didn't know we can add multiple pattern with | char.

Thx Xeno :D

| is an OR

Glad I could help.

Mega

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...