Jump to content

StringRegExp multiline problem?


joelson
 Share

Recommended Posts

$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?

Link to comment
Share on other sites

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

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