Sign in to follow this  
Followers 0
youtuber

StringRegExp receive data?

4 posts in this topic

#1 ·  Posted (edited)

source code

<a href="/url?q=https://www.autoitscript.com/trial&amp;sa=U

<a href="/url?q=https://www.autoitscript.com/trial2/&amp;sa=U

how should it be?

$var = StringRegExp($sData, '(?i).*<a href="/url?q=.*">(.+?)&amp;\sa=U', 3)

Edited by youtuber

Share this post


Link to post
Share on other sites



#include <Array.au3>

$sData = '<a href="/url?q=https://www.autoitscript.com/trial2/&amp;sa=U' & @CRLF & '<a href="/url?q=https://www.autoitscript.com/trial2/&amp;sa=U'


$var = StringRegExp($sData, '(?i).*=(http.+)\&.*', 3)

_ArrayDisplay($var)

 

1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@UEZ Thank you

Which of them is more accurate?

 

#include <Array.au3>

$sData1 = 'id="mref" name="referrer"><title>Autoit</title>'
$var1 = StringRegExp($sData1, '(?i)<title>(.*?)</title>', 3)


$sData2 = 'id="mref" name="referrer"><title>Autoit</title>'
$var2 = StringRegExp($sData2, '(?i)^<title>(.*?)</title>$', 3)

$sData3 = 'id="mref" name="referrer"><title>Autoit</title>'
$var3 = StringRegExp($sData3, '<title>(.?)*?(.*)</', 3)

$sData4 = 'id="mref" name="referrer"><title>Autoit</title>'
$var4 = StringRegExp($sData4, '(?i)(?i)^<title>(.*?)<(.*?)', 3)


_ArrayDisplay($var1)
_ArrayDisplay($var2)
_ArrayDisplay($var3)
_ArrayDisplay($var4)

 

Edited by youtuber

Share this post


Link to post
Share on other sites

#1 is ok
#2 works only if there is nothing before/after $sData2
#3 and #4 are fantasy

There is no need to overcomplicate/overload the pattern

$sData = '<a href="/url?q=https://www.autoitscript.com/trial2/&amp;sa=U' & @CRLF & '<a href="/url?q=https://www.autoitscript.com/trial2/&amp;sa=U'

$var = StringRegExp($sData, 'http[^&]+', 3)
_ArrayDisplay($var)

 

1 person likes this

Share this post


Link to post
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
Sign in to follow this  
Followers 0