Jump to content

@making multi lines match by RegExp


Deye
 Share

Recommended Posts

Hi

I'm Trying to figure out how multi lines should be pended to an expression :?

Thanks

$sString = "Test" & @LF & _
        'Local $Clear_Button = GUICtrlCreateButton("Clear", 313, 211, 50, 20")' & @LF& @LF & _
        '(GUICtrlSetTip(-1, "Clear all Check Boxes")'

$s = '(?m:Local \$Clear_Button = GUICtrlCreateButton\("Clear", 313, 211, 50, 20"\))\n+\n+(GUICtrlSetTip\(\-1, "Clear all Check Boxes"\))'
;~ $s = '(Local \$Clear_Button = GUICtrlCreateButton\("Clear", 313, 211, 50, 20"\))'

$sString = StringRegExpReplace($sString, $s, "")

MsgBox(0, '', $sString)

Deye

Link to comment
Share on other sites

FrancescoDiMuro,

 Adding (?m)(Local...) didn't work for me, I end up with screwed example code when something doesn't work (I did try that too I believe)

Thankfully I want need to get into this, Got the problem solved with my previous post

Thanks 

Link to comment
Share on other sites

I don't know the purpose of this code but please note some details : with your example the multiline option is useless, grouping is not necessary because you don't use backreferences, and \n+\n+ is redundant

$sString = "Test" & @LF & _
        'Local $Clear_Button = GUICtrlCreateButton("Clear", 313, 211, 50, 20")' & @LF& @LF & _
        '(GUICtrlSetTip(-1, "Clear all Check Boxes")'

$s = 'Local \$Clear_Button = GUICtrlCreateButton\("Clear", 313, 211, 50, 20"\)\n+\(GUICtrlSetTip\(\-1, "Clear all Check Boxes"\)'

$sString = StringRegExpReplace($sString, $s, "")
MsgBox(0, '', $sString)

 

Link to comment
Share on other sites

mikell,

I needed this for what i was using here marked as solved as the reproducer shows to me now that  everything should work

but it still Doesn't with my main script,  also tried implementing the replace with this version smae thing: @error = 0, @extended = 0

yet to figure why is that 

Edit just found it out 

Thanks

Edited by Deye
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...