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


Messages In This Thread
Regex, exclude part of string - by Bencori - 05-25-2011, 10:43 AM
RE: Regex, exclude part of string - by Gaijin - 05-25-2011, 11:26 AM

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: 1 Guest(s)