Notepad ++ complex pattern search
up vote
3
down vote
favorite
Hi i'm looking for a notepad++ regex pattern match in a text, and bring some replacements. But so far what I have come up with does not seem to work.
Sample text:
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.
3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. 7 blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.
8 blalalallajhshduie.
9 bslslslslls :
blslsllsllls,
bslslllsllsls.
nsnsnnsnsnnsnns,
hsbbbslslsllsllsls.
10 bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.
Pattern search:
I'm looking for the beginning of any number followed by a space and some texts and stops before the next number preceded by a space is encountered.
grouping should look like:
- groupe 1 : a number
- groupe 2 : the space character following the number
- groupe 3 : some text which can also include some numbers but these numbers are not between space characters,instead they are between (µµ) .
Expected results:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2> blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
<VERSETAG=9>bslslslslls :</VERSETAG>
<VERSETAG=10>bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.</VERSETAG>
Tested with this Regex thanks to @Toto (but so far not working as expected, see result bellow):
Look for :
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
replace with :
<VERSETAG=$1>$2</VERSETAG>n
Result of the test :
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
7 blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.
8 blalalallajhshduie.
9 bslslslslls :
<VERSETAG=10>bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.</VERSETAG>
Thank you very much in advance!
notepad++ regex
New contributor
add a comment |
up vote
3
down vote
favorite
Hi i'm looking for a notepad++ regex pattern match in a text, and bring some replacements. But so far what I have come up with does not seem to work.
Sample text:
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.
3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. 7 blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.
8 blalalallajhshduie.
9 bslslslslls :
blslsllsllls,
bslslllsllsls.
nsnsnnsnsnnsnns,
hsbbbslslsllsllsls.
10 bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.
Pattern search:
I'm looking for the beginning of any number followed by a space and some texts and stops before the next number preceded by a space is encountered.
grouping should look like:
- groupe 1 : a number
- groupe 2 : the space character following the number
- groupe 3 : some text which can also include some numbers but these numbers are not between space characters,instead they are between (µµ) .
Expected results:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2> blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
<VERSETAG=9>bslslslslls :</VERSETAG>
<VERSETAG=10>bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.</VERSETAG>
Tested with this Regex thanks to @Toto (but so far not working as expected, see result bellow):
Look for :
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
replace with :
<VERSETAG=$1>$2</VERSETAG>n
Result of the test :
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
7 blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.
8 blalalallajhshduie.
9 bslslslslls :
<VERSETAG=10>bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.</VERSETAG>
Thank you very much in advance!
notepad++ regex
New contributor
Could you tell us, in words, what your pattern is supposed to achieve?
– harrymc
2 days ago
Hi,As described in the expected result: When it finds a number that is followed by a space , it should put a tag there with that number inside the (<VERSETAG=1>) and before encountering the next number followed by a space, it should put the closing tag.(</VERSETAG>)
– Pmicezjk
2 days ago
I just run with your new test case, it works pretty fine. Have you checked. matches newline
?
– Toto
yesterday
Yes Indeed now working perfectly!! Awesome ! Great help !
– Pmicezjk
yesterday
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Hi i'm looking for a notepad++ regex pattern match in a text, and bring some replacements. But so far what I have come up with does not seem to work.
Sample text:
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.
3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. 7 blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.
8 blalalallajhshduie.
9 bslslslslls :
blslsllsllls,
bslslllsllsls.
nsnsnnsnsnnsnns,
hsbbbslslsllsllsls.
10 bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.
Pattern search:
I'm looking for the beginning of any number followed by a space and some texts and stops before the next number preceded by a space is encountered.
grouping should look like:
- groupe 1 : a number
- groupe 2 : the space character following the number
- groupe 3 : some text which can also include some numbers but these numbers are not between space characters,instead they are between (µµ) .
Expected results:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2> blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
<VERSETAG=9>bslslslslls :</VERSETAG>
<VERSETAG=10>bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.</VERSETAG>
Tested with this Regex thanks to @Toto (but so far not working as expected, see result bellow):
Look for :
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
replace with :
<VERSETAG=$1>$2</VERSETAG>n
Result of the test :
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
7 blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.
8 blalalallajhshduie.
9 bslslslslls :
<VERSETAG=10>bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.</VERSETAG>
Thank you very much in advance!
notepad++ regex
New contributor
Hi i'm looking for a notepad++ regex pattern match in a text, and bring some replacements. But so far what I have come up with does not seem to work.
Sample text:
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.
3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. 7 blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.
8 blalalallajhshduie.
9 bslslslslls :
blslsllsllls,
bslslllsllsls.
nsnsnnsnsnnsnns,
hsbbbslslsllsllsls.
10 bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.
Pattern search:
I'm looking for the beginning of any number followed by a space and some texts and stops before the next number preceded by a space is encountered.
grouping should look like:
- groupe 1 : a number
- groupe 2 : the space character following the number
- groupe 3 : some text which can also include some numbers but these numbers are not between space characters,instead they are between (µµ) .
Expected results:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2> blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
<VERSETAG=9>bslslslslls :</VERSETAG>
<VERSETAG=10>bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.</VERSETAG>
Tested with this Regex thanks to @Toto (but so far not working as expected, see result bellow):
Look for :
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
replace with :
<VERSETAG=$1>$2</VERSETAG>n
Result of the test :
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
7 blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm :
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.
8 blalalallajhshduie.
9 bslslslslls :
<VERSETAG=10>bslsllsllsllsllslls à sbsbbsbbsb , snsnnsnnsnnsn.</VERSETAG>
Thank you very much in advance!
notepad++ regex
notepad++ regex
New contributor
New contributor
edited yesterday
New contributor
asked 2 days ago
Pmicezjk
163
163
New contributor
New contributor
Could you tell us, in words, what your pattern is supposed to achieve?
– harrymc
2 days ago
Hi,As described in the expected result: When it finds a number that is followed by a space , it should put a tag there with that number inside the (<VERSETAG=1>) and before encountering the next number followed by a space, it should put the closing tag.(</VERSETAG>)
– Pmicezjk
2 days ago
I just run with your new test case, it works pretty fine. Have you checked. matches newline
?
– Toto
yesterday
Yes Indeed now working perfectly!! Awesome ! Great help !
– Pmicezjk
yesterday
add a comment |
Could you tell us, in words, what your pattern is supposed to achieve?
– harrymc
2 days ago
Hi,As described in the expected result: When it finds a number that is followed by a space , it should put a tag there with that number inside the (<VERSETAG=1>) and before encountering the next number followed by a space, it should put the closing tag.(</VERSETAG>)
– Pmicezjk
2 days ago
I just run with your new test case, it works pretty fine. Have you checked. matches newline
?
– Toto
yesterday
Yes Indeed now working perfectly!! Awesome ! Great help !
– Pmicezjk
yesterday
Could you tell us, in words, what your pattern is supposed to achieve?
– harrymc
2 days ago
Could you tell us, in words, what your pattern is supposed to achieve?
– harrymc
2 days ago
Hi,As described in the expected result: When it finds a number that is followed by a space , it should put a tag there with that number inside the (<VERSETAG=1>) and before encountering the next number followed by a space, it should put the closing tag.(</VERSETAG>)
– Pmicezjk
2 days ago
Hi,As described in the expected result: When it finds a number that is followed by a space , it should put a tag there with that number inside the (<VERSETAG=1>) and before encountering the next number followed by a space, it should put the closing tag.(</VERSETAG>)
– Pmicezjk
2 days ago
I just run with your new test case, it works pretty fine. Have you checked
. matches newline
?– Toto
yesterday
I just run with your new test case, it works pretty fine. Have you checked
. matches newline
?– Toto
yesterday
Yes Indeed now working perfectly!! Awesome ! Great help !
– Pmicezjk
yesterday
Yes Indeed now working perfectly!! Awesome ! Great help !
– Pmicezjk
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
Update according to comments:
Ctrl+H
- Find what:
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
- Replace with:
<VERSETAG=$1>$2</VERSETAG>n
- check Wrap around
- check Regular expression
- CHECK
. matches newline
- Replace all
Explanation:
(?:^D*|G ) # non capture group, beginning of line followed by 0 or more non digits or restart from the last match position
(d+) # group 1, 1 or more digits
s+ # 1 or more spaces
(.+?) # group 2, 1 or more any character including new line, not greedy
R? # any kind of linebreak, optional
(?=sd+s|z) # positive lookahead, make sure we have after 1 or more digits surround with spaces or end of file
Result for given example:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2>blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
Capture screen
Awesome Toto! We are almost there! but it seems not to be working when the line starts with some texts:For example, the followin is not working :
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl. 3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. dlflflf4532llflflf, vjjsjsjss8776nndndn54; qcqaataab. 7 hhhshhshhshhshhshhs, bslslslsllslsllsll.
– Pmicezjk
yesterday
@Pmicezjk: just replace(?:^|G )
with(?:^D*|G )
at the beginning of regex. See my edit.
– Toto
yesterday
Still not working between (check around versetag 7 and 8). This is what I got when I replace (?:^|G ) with (?:^D*|G )
:<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:</VERSETAG> blslslslsavccacac, hkkdlfmfmmf56balalala. hdfmmfm87kdkkkkfkf. <VERSETAG=8>blalalallajhshduie.</VERSETAG>
– Pmicezjk
yesterday
1
@Pmicezjk: I've completly rewrite the regex, not just addD*
– Toto
yesterday
1
@Pmicezjk: Sorry, I don't get you, it seems working for me. Have you Checked. matches newline
? Please, edit your question and add some input lines that don't work for you.
– Toto
yesterday
|
show 4 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Update according to comments:
Ctrl+H
- Find what:
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
- Replace with:
<VERSETAG=$1>$2</VERSETAG>n
- check Wrap around
- check Regular expression
- CHECK
. matches newline
- Replace all
Explanation:
(?:^D*|G ) # non capture group, beginning of line followed by 0 or more non digits or restart from the last match position
(d+) # group 1, 1 or more digits
s+ # 1 or more spaces
(.+?) # group 2, 1 or more any character including new line, not greedy
R? # any kind of linebreak, optional
(?=sd+s|z) # positive lookahead, make sure we have after 1 or more digits surround with spaces or end of file
Result for given example:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2>blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
Capture screen
Awesome Toto! We are almost there! but it seems not to be working when the line starts with some texts:For example, the followin is not working :
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl. 3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. dlflflf4532llflflf, vjjsjsjss8776nndndn54; qcqaataab. 7 hhhshhshhshhshhshhs, bslslslsllslsllsll.
– Pmicezjk
yesterday
@Pmicezjk: just replace(?:^|G )
with(?:^D*|G )
at the beginning of regex. See my edit.
– Toto
yesterday
Still not working between (check around versetag 7 and 8). This is what I got when I replace (?:^|G ) with (?:^D*|G )
:<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:</VERSETAG> blslslslsavccacac, hkkdlfmfmmf56balalala. hdfmmfm87kdkkkkfkf. <VERSETAG=8>blalalallajhshduie.</VERSETAG>
– Pmicezjk
yesterday
1
@Pmicezjk: I've completly rewrite the regex, not just addD*
– Toto
yesterday
1
@Pmicezjk: Sorry, I don't get you, it seems working for me. Have you Checked. matches newline
? Please, edit your question and add some input lines that don't work for you.
– Toto
yesterday
|
show 4 more comments
up vote
2
down vote
Update according to comments:
Ctrl+H
- Find what:
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
- Replace with:
<VERSETAG=$1>$2</VERSETAG>n
- check Wrap around
- check Regular expression
- CHECK
. matches newline
- Replace all
Explanation:
(?:^D*|G ) # non capture group, beginning of line followed by 0 or more non digits or restart from the last match position
(d+) # group 1, 1 or more digits
s+ # 1 or more spaces
(.+?) # group 2, 1 or more any character including new line, not greedy
R? # any kind of linebreak, optional
(?=sd+s|z) # positive lookahead, make sure we have after 1 or more digits surround with spaces or end of file
Result for given example:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2>blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
Capture screen
Awesome Toto! We are almost there! but it seems not to be working when the line starts with some texts:For example, the followin is not working :
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl. 3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. dlflflf4532llflflf, vjjsjsjss8776nndndn54; qcqaataab. 7 hhhshhshhshhshhshhs, bslslslsllslsllsll.
– Pmicezjk
yesterday
@Pmicezjk: just replace(?:^|G )
with(?:^D*|G )
at the beginning of regex. See my edit.
– Toto
yesterday
Still not working between (check around versetag 7 and 8). This is what I got when I replace (?:^|G ) with (?:^D*|G )
:<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:</VERSETAG> blslslslsavccacac, hkkdlfmfmmf56balalala. hdfmmfm87kdkkkkfkf. <VERSETAG=8>blalalallajhshduie.</VERSETAG>
– Pmicezjk
yesterday
1
@Pmicezjk: I've completly rewrite the regex, not just addD*
– Toto
yesterday
1
@Pmicezjk: Sorry, I don't get you, it seems working for me. Have you Checked. matches newline
? Please, edit your question and add some input lines that don't work for you.
– Toto
yesterday
|
show 4 more comments
up vote
2
down vote
up vote
2
down vote
Update according to comments:
Ctrl+H
- Find what:
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
- Replace with:
<VERSETAG=$1>$2</VERSETAG>n
- check Wrap around
- check Regular expression
- CHECK
. matches newline
- Replace all
Explanation:
(?:^D*|G ) # non capture group, beginning of line followed by 0 or more non digits or restart from the last match position
(d+) # group 1, 1 or more digits
s+ # 1 or more spaces
(.+?) # group 2, 1 or more any character including new line, not greedy
R? # any kind of linebreak, optional
(?=sd+s|z) # positive lookahead, make sure we have after 1 or more digits surround with spaces or end of file
Result for given example:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2>blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
Capture screen
Update according to comments:
Ctrl+H
- Find what:
(?:^D*|G )(d+)s+(.+?)R?(?=sd+s|z)
- Replace with:
<VERSETAG=$1>$2</VERSETAG>n
- check Wrap around
- check Regular expression
- CHECK
. matches newline
- Replace all
Explanation:
(?:^D*|G ) # non capture group, beginning of line followed by 0 or more non digits or restart from the last match position
(d+) # group 1, 1 or more digits
s+ # 1 or more spaces
(.+?) # group 2, 1 or more any character including new line, not greedy
R? # any kind of linebreak, optional
(?=sd+s|z) # positive lookahead, make sure we have after 1 or more digits surround with spaces or end of file
Result for given example:
<VERSETAG=1>blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=2>blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl.</VERSETAG>
<VERSETAG=3>blalblblbl: blablaa; balal blala.</VERSETAG>
<VERSETAG=4>blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl.</VERSETAG>
<VERSETAG=5>jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk.</VERSETAG>
<VERSETAG=6>fshhhshs, nnsnnsns! nsnnsn.</VERSETAG>
<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:
blslslslsavccacac,
hkkdlfmfmmf56balalala.
hdfmmfm87kdkkkkfkf.</VERSETAG>
<VERSETAG=8>blalalallajhshduie.</VERSETAG>
Capture screen
edited yesterday
answered 2 days ago
Toto
3,23281125
3,23281125
Awesome Toto! We are almost there! but it seems not to be working when the line starts with some texts:For example, the followin is not working :
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl. 3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. dlflflf4532llflflf, vjjsjsjss8776nndndn54; qcqaataab. 7 hhhshhshhshhshhshhs, bslslslsllslsllsll.
– Pmicezjk
yesterday
@Pmicezjk: just replace(?:^|G )
with(?:^D*|G )
at the beginning of regex. See my edit.
– Toto
yesterday
Still not working between (check around versetag 7 and 8). This is what I got when I replace (?:^|G ) with (?:^D*|G )
:<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:</VERSETAG> blslslslsavccacac, hkkdlfmfmmf56balalala. hdfmmfm87kdkkkkfkf. <VERSETAG=8>blalalallajhshduie.</VERSETAG>
– Pmicezjk
yesterday
1
@Pmicezjk: I've completly rewrite the regex, not just addD*
– Toto
yesterday
1
@Pmicezjk: Sorry, I don't get you, it seems working for me. Have you Checked. matches newline
? Please, edit your question and add some input lines that don't work for you.
– Toto
yesterday
|
show 4 more comments
Awesome Toto! We are almost there! but it seems not to be working when the line starts with some texts:For example, the followin is not working :
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl. 3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. dlflflf4532llflflf, vjjsjsjss8776nndndn54; qcqaataab. 7 hhhshhshhshhshhshhs, bslslslsllslsllsll.
– Pmicezjk
yesterday
@Pmicezjk: just replace(?:^|G )
with(?:^D*|G )
at the beginning of regex. See my edit.
– Toto
yesterday
Still not working between (check around versetag 7 and 8). This is what I got when I replace (?:^|G ) with (?:^D*|G )
:<VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:</VERSETAG> blslslslsavccacac, hkkdlfmfmmf56balalala. hdfmmfm87kdkkkkfkf. <VERSETAG=8>blalalallajhshduie.</VERSETAG>
– Pmicezjk
yesterday
1
@Pmicezjk: I've completly rewrite the regex, not just addD*
– Toto
yesterday
1
@Pmicezjk: Sorry, I don't get you, it seems working for me. Have you Checked. matches newline
? Please, edit your question and add some input lines that don't work for you.
– Toto
yesterday
Awesome Toto! We are almost there! but it seems not to be working when the line starts with some texts:
For example, the followin is not working :
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl. 3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. dlflflf4532llflflf, vjjsjsjss8776nndndn54; qcqaataab. 7 hhhshhshhshhshhshhs, bslslslsllslsllsll.
– Pmicezjk
yesterday
Awesome Toto! We are almost there! but it seems not to be working when the line starts with some texts:
For example, the followin is not working :
1 blablablabla. blablnsnsnns, blalblblbl: blablaa; balal blala. 2 blblb'blbµµ77777µµlblb blblb, blslsµµ105µµnlsllsl. 3 blalblblbl: blablaa; balal blala. 4 blblb'blbµµ9999µµlblb . Blblb, blslsnlsllsl. 5 jsjjsjj; gggbqbqbq: ghshhqhhqh !. Gsgsjjsskksk. 6 fshhhshs, nnsnnsns! nsnnsn. dlflflf4532llflflf, vjjsjsjss8776nndndn54; qcqaataab. 7 hhhshhshhshhshhshhs, bslslslsllslsllsll.
– Pmicezjk
yesterday
@Pmicezjk: just replace
(?:^|G )
with (?:^D*|G )
at the beginning of regex. See my edit.– Toto
yesterday
@Pmicezjk: just replace
(?:^|G )
with (?:^D*|G )
at the beginning of regex. See my edit.– Toto
yesterday
Still not working between (check around versetag 7 and 8). This is what I got when I replace (?:^|G ) with (?:^D*|G )
: <VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:</VERSETAG> blslslslsavccacac, hkkdlfmfmmf56balalala. hdfmmfm87kdkkkkfkf. <VERSETAG=8>blalalallajhshduie.</VERSETAG>
– Pmicezjk
yesterday
Still not working between (check around versetag 7 and 8). This is what I got when I replace (?:^|G ) with (?:^D*|G )
: <VERSETAG=7>blalallallal7600hhzhz ; nmmkzjzbzbzb34fspmmm:</VERSETAG> blslslslsavccacac, hkkdlfmfmmf56balalala. hdfmmfm87kdkkkkfkf. <VERSETAG=8>blalalallajhshduie.</VERSETAG>
– Pmicezjk
yesterday
1
1
@Pmicezjk: I've completly rewrite the regex, not just add
D*
– Toto
yesterday
@Pmicezjk: I've completly rewrite the regex, not just add
D*
– Toto
yesterday
1
1
@Pmicezjk: Sorry, I don't get you, it seems working for me. Have you Checked
. matches newline
? Please, edit your question and add some input lines that don't work for you.– Toto
yesterday
@Pmicezjk: Sorry, I don't get you, it seems working for me. Have you Checked
. matches newline
? Please, edit your question and add some input lines that don't work for you.– Toto
yesterday
|
show 4 more comments
Pmicezjk is a new contributor. Be nice, and check out our Code of Conduct.
Pmicezjk is a new contributor. Be nice, and check out our Code of Conduct.
Pmicezjk is a new contributor. Be nice, and check out our Code of Conduct.
Pmicezjk is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1374975%2fnotepad-complex-pattern-search%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Could you tell us, in words, what your pattern is supposed to achieve?
– harrymc
2 days ago
Hi,As described in the expected result: When it finds a number that is followed by a space , it should put a tag there with that number inside the (<VERSETAG=1>) and before encountering the next number followed by a space, it should put the closing tag.(</VERSETAG>)
– Pmicezjk
2 days ago
I just run with your new test case, it works pretty fine. Have you checked
. matches newline
?– Toto
yesterday
Yes Indeed now working perfectly!! Awesome ! Great help !
– Pmicezjk
yesterday