Jump to content

letters, one comma and one space


crackpanda

Recommended Posts

Could you give an example of input and desired output? What silkfire has given will match the literal string 'A-Za-z ,'. I'm guessing for your first question you were looking to match something more like 'said, '?

 

In which case you will need to alter the pattern to look like:

/[A-Za-z]+, /

 

Placing the A-Z in the square brackets makes it a character class and will search for letters A to Z. Not inside the square brackets is just looking for the literal string 'A-Z', not the required result right? Also, you will not want the ^ sign at the beginning and the $ sign at the end. That will mean that the regex has to match from the beginning (^) till the end ($) of the input string. Again I'm presuming as you didn't provide an example with your question, but it sounds like you are looking for a match in a large section of text?

 

Hope this helps,

Joe

Link to comment
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.