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!










share|improve this question









New contributor




Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Could you tell us, in words, what your pattern is supposed to achieve?
    – harrymc
    yesterday










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

















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!










share|improve this question









New contributor




Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Could you tell us, in words, what your pattern is supposed to achieve?
    – harrymc
    yesterday










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















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!










share|improve this question









New contributor




Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question









New contributor




Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday





















New contributor




Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Pmicezjk

163




163




New contributor




Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Pmicezjk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Could you tell us, in words, what your pattern is supposed to achieve?
    – harrymc
    yesterday










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




















  • Could you tell us, in words, what your pattern is supposed to achieve?
    – harrymc
    yesterday










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


















Could you tell us, in words, what your pattern is supposed to achieve?
– harrymc
yesterday




Could you tell us, in words, what your pattern is supposed to achieve?
– harrymc
yesterday












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
yesterday






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
yesterday














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












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



enter image description here






share|improve this answer























  • 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 add D*
    – 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











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Pmicezjk is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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
































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



enter image description here






share|improve this answer























  • 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 add D*
    – 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















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



enter image description here






share|improve this answer























  • 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 add D*
    – 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













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



enter image description here






share|improve this answer














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



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered yesterday









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 add D*
    – 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












  • @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 add D*
    – 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










Pmicezjk is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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.















 


draft saved


draft discarded














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




















































































Popular posts from this blog

Aardman Animations

Are they similar matrix

“minimization” problem in Euclidean space related to orthonormal basis