Jump to content

Recommended Posts

I've decided that knowing a good portion of Regex is a necessity. Sadly, starting out always seems to be the hardest. In the following expression, I attempt to match anything that starts with

.

 

Like so:

 


/\[quote=[a-zA-Z0-9]\]/g

 

So for instance, I'd like for it to match something like this:

 


[quote=bob]

 

Any reasons why it doesn't seem to work? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/263566-my-start-to-regex/
Share on other sites

[a-zA-Z0-9]

By itself that means only one. It would work with quote=b. Add a "quantifier" to it - which one depends on what you want to allow.

 

I'm not looking for just quote=b. :/

 

I'm looking for [tt]

[tt]

Right. Which is why you should add a quantifier.

Link to comment
https://forums.phpfreaks.com/topic/263566-my-start-to-regex/#findComment-1350749
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.