| View previous topic :: View next topic |
| Author |
Message |
Diagmato LXF regular
Joined: Sat Apr 01, 2006 10:37 pm Posts: 272 Location: Cardiff
|
Posted: Tue Dec 05, 2006 10:32 pm Post subject: PHP extracting text from between two seperate points |
|
|
Im trying to write code which:
-finds the first occurance of ... ("..." is a sentance).
-Somehow takes the sentance from between the bbcode, and stores it in another variable
I was initially thinking of explode(), however the start and ending 'tokens' are different.
Any ideas? _________________ My Blog
Micro$oft gives you Windows, Linux gives you the full house |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8000 Location: Warrington, UK
|
Posted: Tue Dec 05, 2006 11:41 pm Post subject: RE: PHP extracting text from between two seperate points |
|
|
It sounds like a job for a regular expression. _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
TonyLB LXF regular
Joined: Tue Apr 12, 2005 8:08 pm Posts: 111 Location: Wirral, UK
|
Posted: Wed Dec 13, 2006 10:59 pm Post subject: RE: PHP extracting text from between two seperate points |
|
|
If you can identify the end point as well, then use substr(string, start, length)
Find the start position s, the end position e
newString = substr(oldString, s+1, e-s)
Tony _________________ In the beginning was nothing, which exploded! (Lords and Ladies, Terry Pratchett) |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|