apbonn Posted May 25, 2020 Posted May 25, 2020 Hi, im using this statement to get a specific content between two tags: StringRegExp($content,'<resource>xy:/resources/([^<]*)<\/resource>',3) It works fine. But now i have to add a functionality, because it can happen, that after "<resource" another tags comes up, but the regex should ignore it the content can be like this <resource>xy:/resources/xyz/123</resource> <resource mytag="xy">xy:/resources/xyz/123</resource> what do i have to change to my rule, that is has something like StringRegExp($content,'<resource I_DONT_CARE_WHAT_STANDS_HERE>xyz:/resources/([^<]*)<\/resource>',3) any ideas?
Developers Jos Posted May 25, 2020 Developers Posted May 25, 2020 just a stab: StringRegExp($content,'<resource.*?>xy:/resources/([^<]*)<\/resource>',3) Post a runnable test script when you want it confirmed as I am way too lazy to have to type that myself. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
mikell Posted May 25, 2020 Posted May 25, 2020 You might try to do it backwards #Include <Array.au3> $content = '<resource>xy:/resources/xyz/123</resource>' & @crlf & _ '<resource mytag="xy">xy:/resources/xyz/456</resource>' $res = StringRegExp($content,'([^/]+)</resource>', 3) ; or this, depending of the expected result ; $res = StringRegExp($content,'([^/]+/[^/]+)</resource>', 3) _ArrayDisplay($res)
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