eyeblue Posted August 16, 2018 Share Posted August 16, 2018 I have stringnumber=1 number=2 number=3 selector number=4 number=5 number=6I need regex start string selector take number 4&5&6 in one pattern unique stringregexp . I don't want regex twice. Please help me, thank you so much ! Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted August 16, 2018 Share Posted August 16, 2018 What did you try so far? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
eyeblue Posted August 16, 2018 Author Share Posted August 16, 2018 I do this. But i want regex once, i don't want use regex twice #include <Array.au3> $string = "number=1" & @CRLF & _ "number=2" & @CRLF & _ "number=3" & @CRLF & _ "selector" & @CRLF & _ "number=4" & @CRLF & _ "number=5" & @CRLF & _ "number=6" & @CRLF & _ "number=7" $regex= StringRegExp(StringRegExp($string,"selector([^\h]+)",1)[0],"(\d+)",3) _ArrayDisplay($regex) Link to comment Share on other sites More sharing options...
mikell Posted August 16, 2018 Share Posted August 16, 2018 (edited) Here is one As usual, it works with the provided text but will need to be amended if the requirements are differents in the real life #Include <Array.au3> $text = "number=1" & @crlf & _ "number=2" & @crlf & _ "number=3" & @crlf & _ "selector " & @crlf & _ "number=4" & @crlf & _ "number=5" & @crlf & _ "number=6" ;Msgbox(0,"", $text) $a = StringRegExp($text, '(?s).*selector(*SKIP)(*F)|(\d+)', 3) _ArrayDisplay($a) Edited August 16, 2018 by mikell eyeblue 1 Link to comment Share on other sites More sharing options...
eyeblue Posted August 16, 2018 Author Share Posted August 16, 2018 MVPs thank you so much. I love you <3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now