0

I'm trying to mass update a web app, I need to create a regex that matches:

lang::id(ALLCHARACTERS]

Can someone assist me with this? I'm not good with regex. I'm pretty sure it can start like:

lang\:\:\(WHAT GOES HERE\]
4

2 回答 2

2

Something like this would work:

lang::id\([^]]*]

This will match a literal lang::id\(, followed by zero or more of any character other than ], followed by a literal ].

Note that the only character that really needs to be escaped is the open parenthesis.

于 2013-10-02T18:40:09.677 回答
1

lang::id\(.*]

The . means any single character, and then * repeats it zero->N times. Make sure to escape the ( since it is used inside regex and is a special char for them, so escaping it with \ is needed, or the regex will probably complain about unbalanced parenthesis.

If you wanted it to not include all characters, you can add a smaller regex in place of the .*. This way you can break the regex down into smaller chunks which help make it easier to understand and develop for some complex rules.

于 2013-10-02T18:40:00.260 回答