Regex - match a string not contain a 'semi-word'
I tried to make regex syntax for that but I failed.
I have 2 variables
PlayerInfo[playerid][pLevel] and Character[playerid]
and I want to catch only the second variable,I mean only the world what don't contain PlayerInfo, but cointains [playerid]
"(\S+)\[playerid\]"
cath both words and (\S+[^PlayerInfo])\[playerid\]
jump on some variables- they cont开发者_运维知识库ais p,l,a,y ...
I need to replace in notepad++,all variables like Text[playerid] to ExClass [playerid][Text]
Couple Pluasible solutions.
List item
- Notepad has a plugin called python script. Running regex from there gives full regex functionality, the python version anyway, and a lot of powerful potential beyond that. And I use the online python regex tester to help out.
- RegRexReplace plugin helps create regex plugins in Notepad++, so when you do hit a limitation, you find out a lot quicker.
- Or of course default to your alternate editor (I'm assuming you have one?) or this online regex tool is absolutely amazing. You can perform the action on the text online as well.
(I'd try to build a regex for you, but I'm a bit lost as to what you're looking for. Unless the Ivo Abeloos got it. If you're still coming up short, maybe a code example along with values displayed?) Good luck!
It seems that Notepad++ support negative lookbehind since v6.
In notepad++ you could try to replace (.+)\[(.+)\]
with ExClass\[\2\]\[\1\]
Try to use negative lookbehind.
(?<!PlayerInfo)\[playerid\]
EDIT: unfortunately notepad++ does not support negative lookbehind.
I tried to make a workaround based on the following naive idea:
(.[^o]|[^f]o)[playerid]
But this expression does not work either. Notepad++ seems to fail in alternative operator. Thus the answer is: it is impossible to do exactly what you want. Try to solve the problem in other way or use alternative tool.
精彩评论