|
List Info
Thread: Returning a string between two substrings
|
|
| Returning a string between two
substrings |

|
2006-07-19 09:39:14 |
Howdy,
Looking for a function that will find a substring between
two
substrings. For example:
"this is some text [url]http://www.url.com[/url] this
is some more
text."
I need a function that can return the url in the above
example so I can
change it to a html link. Obviously the url can be of
changing length
which makes it complicated to code.
anyone got ideas?
Cheers,
Ciaran
--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.
For information or project assistance please visit :
http://www.360psg.com
You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHP googlegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribe googlegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---
|
|
| Returning a string between two
substrings |

|
2006-07-19 09:48:57 |
|
are you looking ALWAYS for a URL ?
find a pattern to match the substring you are looking for and use
pregmatch() ( http://ro.php.net/preg_match ) to find it
Regards,
Dragos Ardeleanu
webdeveloper
http://www.xmldev.ro
YM: xmldev_ro
Skype ID: adragos
cron wrote:
b28g2000cwb.googlegroups.com"
type="cite">
Howdy,
Looking for a function that will find a substring between two
substrings. For example:
"this is some text [url]http://www.url.com[/url] this is some more
text."
I need a function that can return the url in the above example so I can
change it to a html link. Obviously the url can be of changing length
which makes it complicated to code.
anyone got ideas?
Cheers,
Ciaran
--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development staff at 360 PSG. An enterprise application development company utilizing open-source technologies for todays small-to-medium size businesses.
For information or project assistance please visit :
http://www.360psg.com
You received this message because you are subscribed to the Google Groups "Professional PHP Developers" group.
To post to this group, send email to googlegroups.com">Professional-PHP googlegroups.com
To unsubscribe from this group, send email to googlegroups.com">Professional-PHP-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---
|
| Returning a string between two
substrings |

|
2006-07-19 10:37:53 |
|
|
Yeah I am looking always for a url in this case. I'll
check that out. Thanks for the reply
are you looking ALWAYS for a URL ? find a
pattern to match the substring you are looking for and use pregmatch() ( http://ro.php.net/preg_match ) to find
it
Regards, Dragos Ardeleanu
webdeveloper http://www.xmldev.ro YM:
xmldev_ro Skype ID: adragos
cron wrote:
b28g2000cwb.googlegroups.com
type="cite">Howdy,
Looking for a function that will find a substring between two
substrings. For example:
"this is some text [url]http://www.url.com[/url] this is some more
text."
I need a function that can return the url in the above example so I can
change it to a html link. Obviously the url can be of changing length
which makes it complicated to code.
anyone got ideas?
Cheers,
Ciaran
--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development staff at 360 PSG. An enterprise application development company utilizing open-source technologies for todays small-to-medium size businesses.
For information or project assistance please visit :
http://www.360psg.com
You received this message because you are subscribed to the Google Groups "Professional PHP Developers" group.
To post to this group, send email to Professional-PHP googlegroups.com
To unsubscribe from this group, send email to Professional-PHP-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/Professional-PHP -~----------~----~----~----~------~----~------~--~---
|
| Returning a string between two
substrings |

|
2006-07-19 10:42:18 |
Yeah, I am, Cheers, I'll have a look at that
--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.
For information or project assistance please visit :
http://www.360psg.com
You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHP googlegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribe googlegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---
|
|
| Returning a string between two
substrings |

|
2006-07-19 19:40:52 |
Got it working:
The following code replaces the characters between the [url]
and [/ur]
tags with HTML code for a hyperlink:
<?php
$result= "some text containing url tags within
it";
$result=preg_replace("!\[url\](.*)\[/url\]!"
,"<a
href=\"\\1\">\\1</a>",
$result);
echo $result;
?>
Hope that helps someone!
--~--~---------~--~----~------------~-------~--~----~
This group is managed and maintained by the development
staff at 360 PSG. An enterprise application development
company utilizing open-source technologies for todays
small-to-medium size businesses.
For information or project assistance please visit :
http://www.360psg.com
You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHP googlegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribe googlegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---
|
|
[1-5]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|