Jump to content

StringRegExp receive data?


Recommended Posts

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
Link to comment
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)

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

@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
Link to comment
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)

 

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...