One of these days I intend to tutor myself on this subject -_- Anyway, I'm confused on how to use these 100%, what I'm trying to do is use a preg function to find whats between two sets of characters i.e: 1012|:|<B>Greenbay123<BR> // here what I need to gather is Greenbay123, though sometimes it will be a little different as so 1015|:|<B>Example 1098 bahdf<p align="right"> // here I would need Steelers 1098 bahdf Code (markup): The four digit numbers to the left may include characters or more digits, in that spot I would like to have a dynamic variable. The four digits to the left is the ID, the |:| is a separator, and beyond that is the title. I'm trying to get the title for each ID so I can finally convert this ancient text-based database script of mine into sql -_- I believe every entry will have an HTML tag right after the entry title, so basically I'm trying to find whats between $var and < If anybody could help me I'd greatly appreciate it, thanks.
Hope this works for you: $file = '1012|:|<B>Greenbay123<BR>'; $file1 = '1015|:|<B>Example 1098 bahdf<p align="right">'; preg_replace('/(.*?)\|\:\|<B>(.*?)<BR>/ies', '$a = trim(\'$2\');', $file); preg_replace('/(.*?)\|\:\|<B>(.*?)<p(\s*?)align\=\"right\">/ies', '$b = trim(\'$2\');', $file1); Code (markup):