Sign in to follow this  
Followers 0
joelson

StringRegExp multiline problem?

4 posts in this topic

$search = FileFindFirstFile("*.html*")
; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    $web=FileRead($file)
    $array = StringRegExp($web,'<title>(.*?)</title>',1)
    for $i = 0 to UBound($array) -1
    
FileMove($file, $array[$i]&".html",1)
Next

WEnd
FileClose($search)

when the tag of html is single line, the code working sample:

<title>test</title>

when the tag of html is multiline, the code not working sample:

<title>test

test</title>

how solve this problem?

Share this post


Link to post
Share on other sites



Add '(?s)' to the front of the regular expression.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

(?s) should solve your problems.

'(?s)<title>(.*?)</title>'

edit:

eh...

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

(?s) should solve your problems.

'(?s)<title>(.*?)</title>'

edit:

eh...

Thank you all

worked well

Solved! ;)

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