faustf Posted October 9, 2018 Share Posted October 9, 2018 hi guys why if i use \d+ not match only digit ? #include <Array.au3> Local $iLIP1= StringRegExp('Anakin."120" Yoda', 'Anakin."\d+" Yoda', 3) _ArrayDisplay($iLIP1,"ana") thankz Link to comment Share on other sites More sharing options...
Danyfirex Posted October 9, 2018 Share Posted October 9, 2018 You're using the no wanted string in the pattern. #include <Array.au3> Local $iLIP1 = StringRegExp('Anakin."120" Yoda', '\d+', 3) _ArrayDisplay($iLIP1, "ana") Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted October 9, 2018 Author Share Posted October 9, 2018 (edited) ok but if i have text much long of 'Anakin."120" Yoda' this and in middle of text have 2 marker Anakin and yoda and in middle a number , why my exprfession dont katch ? only number? Edited October 9, 2018 by faustf Link to comment Share on other sites More sharing options...
Malkey Posted October 9, 2018 Share Posted October 9, 2018 (edited) If you want 120 extracted from the sample text, then try this. #include <Array.au3> Local $aLIP1 = StringRegExp('Star."100" Anakin."120" Yoda."140" Wars', 'Anakin\."(\d+)" Yoda', 3) ; "(\d+)" - this group captures only digits. _ArrayDisplay($aLIP1, "ana") ; Array only contains $aLIP1[0] = 120 ; or MsgBox(0, "Result", StringRegExp('Star."100" Anakin."120" Yoda."140" Wars', 'Anakin\."(\d+)" Yoda', 3)[0]) Edited October 9, 2018 by Malkey Changed "." to "\.'" in RE pattern in order to match a literal dot, ".". faustf 1 Link to comment Share on other sites More sharing options...
Simpel Posted October 9, 2018 Share Posted October 9, 2018 Then you use () to embed the wanted part: Local $iLIP1= StringRegExp('Anakin."120" Yoda', 'Anakin."(\d+)" Yoda', 3) ; currently untested Simpel faustf 1 SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
faustf Posted October 9, 2018 Author Share Posted October 9, 2018 thankz so much at all Link to comment Share on other sites More sharing options...
iamtheky Posted October 9, 2018 Share Posted October 9, 2018 do you always just need the thing that is in double quotes? just regexing for fun? msgbox(0, '' , stringsplit('Anakin."120" Yoda' , '"' , 2)[1]) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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