Is there a way to search in html file for a specific string and the same string plus some other content? For example:
abc.php?t=123 and also abc.php?t=123&page=2 and abc.php?t=123&page=3. Is there a regex that can do the job along with preg_match()?
match string in html file
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: match string in html file
Post the entire contents of your html. It is dificult to create the parameters without knowing the boundaries. For instance, most url's are enclosed in quotes, so a simple regex would like like
Which will capture any string beginning with abc.php until it reaches a double quote.
Code: Select all
preg_match('~(abc\.php[^"]+)~im', $htmlsource, $matches);