Jump to content

Alpha with hyphens?


gergy008

Recommended Posts

Oof, This is my first time at regex, iknow nothing, I didn't know where to start at all, So I asked here,, Once I know this simple question, I can then use tutorials and ask what each bit does.

 

I forgot to add it's for a name feld, I was using just alpha, But then a friend tried to enter gavin-williams and didn't turn out to good.

Link to comment
Share on other sites

I am using this now,

 

^[a-zA-Z\u002D\u002E]+$

 

I built it with RegexBuddy, Haha, Not a legitimate download, I kinda stole it but who cares.

 

That should let any character between a-z in lowercase or higher case, The character '.' and the character '-'.

All characters greedy.

 

Is this right? If so it's solved.

Link to comment
Share on other sites

I am using this now,

 

^[a-zA-Z\u002D\u002E]+$

 

I built it with RegexBuddy, Haha, Not a legitimate download, I kinda stole it but who cares.

 

That should let any character between a-z in lowercase or higher case, The character '.' and the character '-'.

All characters greedy.

 

Is this right? If so it's solved.

 

I have finally come up with ^[a-zA-Z]+[\-\. ]*$ and it seems to be working fine.

 

It allows names like

 

Williams

Williams .Jr

Gavin-Wlliams .Sr etc.

 

Thanks for the recommendations guys!

 

I should also like to point out that RegexBuddy works great and you can download the torrent from here for all those other new people at this difficult stuff, Well, It seems simple I know what most of it does.

 

RegexBuddy tells you what every part does in the Regualr expression.

 

 

Edit (Daniel0): Sorry, but no piracy here...

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.