Split up source

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Split up source

Post by Todd_Z »

Two regex's needed:

1. preg_split source code into an array like this:
[0] => <!DOCTYPE .....>
[1] => <html>
[2] => <head>
[3] => <title>
[4] => Acdrifter.com
[5] => </title>
[6] => </head>
[etc.......]

2. preg_math to see whether a line of that code is a tag or a content entry.
true: </head>
true: <div class="box" style="margin-top: 5px;">
etc....

Code: Select all

  $regex = &quote;#&lt;/?\w+( ї\w-]+=\&quote;.+\&quote;)*( /)?&gt;#&quote;;


http://www.acdrifter.com/tester.php for the progress - It shows the regex expression and the results.
ody
Forum Contributor
Posts: 147
Joined: Sat Mar 27, 2004 4:42 am
Location: ManchesterUK

Post by ody »

Post Reply