Jump to content

Fairly simple regex question


Inigo

Recommended Posts

Hi Guys. This should- hopefully- be a pretty simple question for someone with regex experience to answer. I've been reading all the regex guides and tried various things but none have worked and I'm starting to get a headache. I've decided to just pitch the question here.

 

How do I test if a string contains ONLY a certain character- but could be one or more instances of that character. In this case it's a comma. So:

 

','          -> Would return TRUE

',,,'        -> Would return TRUE

',,,,,,,'    -> Would return TRUE

 

',,,hello,' -> Would return FALSE

'hi,,,'      -> Would return FALSE

 

 

Thanks in advance!

 

 

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.