Jump to content

StringRegExp Question


Recommended Posts

try (\d+) or (\d{19}) and (\d{20})

\d+ matches at least one digit followed by as many digits as possible

\d{19} matches 19 digits

\d{20} ... guess ... 20 digits, right.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

hmm, maybe I'm doing something wrong.

CODE
Func GetLinks()

_IENavigate($oIE, "http://www.google.com/alerts/manage?hl=en&gl=us")

_IELoadWait($oIE)

$body = _IEBodyReadHTML($oIE)

$links = StringRegExp($body, "(\D+)(\d+)(\D)(\d+)", 1)

For $link in $links

FileWriteLine($FeedFile, $link)

Next

EndFunc

http://www.google.com/alerts/feeds/1001429...773879324373026

There's a bunch of links that look like that, just the digits are different, i want to take each entire link and write it as a line in $FeedFile.

Any ideas?

Link to comment
Share on other sites

you have to set the brackets in an other way:

$link = "text text text text text http://www.google.com/alerts/feeds/10014295542174222516/2316773879324373026 tesxt tesxt tesxt "
$links = StringRegExp($link,"(http://\D+\d+\D\d+)",3)
For $i = 0 To UBound($links)-1
    ConsoleWrite($links[$i] & @CRLF)
Next

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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