here is My regexp problem
Texte= "Bonjour"+#crlf$+"Bonsoir"
I want to insert "ino" beside "on"
example of result Binoonjour+ ##Crlf$+"Binoonsoir"
How ca i do ?
Thanks in advance
Replace inside a regexp
Re: Replace inside a regexp
Code: Select all
Texte$ = "Bonjour" + " et " + "Bonsoir"
If CreateRegularExpression(0, "on")
Result$ = ReplaceRegularExpression(0, Texte$, "inoon")
Else
Debug RegularExpressionError()
EndIf
Debug Result$
Fonctionne bien sur avec Texte$ = "Bonjour"+ #CRLF$ +"Bonsoir"Debug wrote:Binoonjour et Binoonsoir
Last edited by falsam on Tue Mar 28, 2017 10:16 am, edited 1 time in total.
➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect.
Re: Replace inside a regexp
(in your request sample, not beside, but before)loulou2522 wrote:here is My regexp problem
Texte= "Bonjour"+#crlf$+"Bonsoir"
I want to insert "ino" beside "on"
example of result Binoonjour+ ##Crlf$+"Binoonsoir"
Code: Select all
--- Source
Bonjour
Bonsoir
--- Expected
Binoonjour
Binoonsoir
--- Search for
^(B)(onjour\r\nB)(onsoir)$
--- Replace with
$1ino$2ino$3
--- Result
Binoonjour
Binoonsoir
Code: Select all
EnableExplicit
Define Texte1.s = "Bonjour" + #CRLF$ + "Bonsoir"
Debug "--- Before " + #CRLF$ + Texte1 + #CRLF$
Define Texte2.s = ReplaceString(Texte1, "on", "inoon")
Debug "--- After " + #CRLF$ + Texte2 + #CRLF$
; --- Before
; Bonjour
; Bonsoir
;
; --- After
; Binoonjour
; Binoonsoir