/[{}[\]^]+/g,
The above Regex expression is copied from a javascript function and need to eliminate the global search for open and close square braces. [] and leave the other parameters. I can only recognize the close brace but not the open.
/[{}[\]^]+/g,
In reverse, I need a Regex expression in which ONLY the open and close square braces. [] are searched for regardless of their position.
Thanks in advance for any help.
Help is asked for, with two Regex expressions
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Help is asked for, with two Regex expressions
TextPad 8.16.0 64bit in English and TextPad 9.1.0 64bit in French, on two separate Windows installations
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
I don't entirely understand what you want.
To search for (curly) braces use
[{}]
that is, either a { or a } .
To search for (square) brackets use
[[\]]
that is, either a [ or a (quoted) ] ,
or
[][]
that is, either a ] (which doesn't need to be quoted here as it's the first character in the character set) or a [ .
Edit: Corrected typo.
To search for (curly) braces use
[{}]
that is, either a { or a } .
To search for (square) brackets use
[[\]]
that is, either a [ or a (quoted) ] ,
or
[][]
that is, either a ] (which doesn't need to be quoted here as it's the first character in the character set) or a [ .
Edit: Corrected typo.
Last edited by ben_josephs on Sun Jan 31, 2016 9:21 pm, edited 1 time in total.
Much thanks for the clarification. I didn't know which square brace did what, as well as what the caret ^ and the plus + sign meant in the context, as well as the first forward slash, (I did know that /g meant global). I meant to separate the expressions where one is to be for the square braces and the other is for the curly braces. Now it's all clear to me. Thanks again.ben_josephs wrote:I don't entirely understand what you want.
To search for (curly) braces use
[{}]
that is, either a } or a { .
To search for (square) brackets use
[[\]]
that is, either a [ or a (quoted) ] ,
or
[][]
that is, either a ] (which doesn't need to be quoted here as it's the first character in the character set) or a [ .
TextPad 8.16.0 64bit in English and TextPad 9.1.0 64bit in French, on two separate Windows installations