 |
Results from the most recent live auction are here.
19 members in the live chat room. Join Chat!
| |
06-08-2008, 02:57 PM
|
· #1 | | The original NP Emo Kid Name: Liam Dawe Location: Plymouth, UK Join Date: Jan 2005
Posts: 1,562
NP$: 91.00 ( Donate)
| PHP: preg match Hi all i am new to regex kinda stuff and need to know how to find "$block" within a load of text?
Last edited by liam_d : 06-08-2008 at 03:26 PM.
|
| |
06-08-2008, 09:35 PM
|
· #2 | | DNOA Member Name: Matthew Holt Location: 127.0.0.1 Join Date: May 2004
Posts: 4,867
NP$: 17.21 ( Donate)
| Well, the strpos function is pretty good for finding an occurance within a string: www.php.net/strpos
It will return the first "spot" it finds of any occurrence without the need for regex.
Use regex to find patterns - not static blocks of text. Are you looking for a regex tutorial?
__________________ FREE: Help With Code
Includes other technical topics: programming, development, Windows, domain names, and Internet |
| |
06-09-2008, 03:50 AM
|
· #3 | | NamePros Regular Join Date: May 2008
Posts: 202
NP$: 40.00 ( Donate)
| preg_match is mainly used to validate data, testing if the input data matches the expression you give. Its not used to find an occurance of data.
Use the strpos as mentioned above, I think its more suited to what your wanting to do. |
| |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |