Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex, exclude part of string
#1
Hi,

I'm trying to make a regex that would return only a number from a BBCode string. Like this:

Code:
[bbcode=50]bla bla bla bla[/bbcode]

I only want "50". So I could do it the dirty way, but I'm looking for a better way to "exclude" 50.

So I make my pattern, like this:

Code:
#\[bbcode\=[0-9]*\](.*?)\[\/bbcode\]#

I think the expression above should match anything between my tags.

Now, what I'm trying to extract the number before the replace. Anyone knows how to do this?

Thanks.



Reply
#2
http://www.supportforums.net/showthread.php?tid=1676 (3rd preg_replace)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Some Regex Help Sato 1 1,137 07-14-2012, 05:22 PM
Last Post: 'Snorlax

Forum Jump:


Users browsing this thread: 2 Guest(s)