Hey all,
I have a very simple regular expression that I use when I want to allow only letters with spaces. (I know this regex has a lot of shortcomings, but I'm still trying to learn them)
isAlpha='^[a-zA-Z\s]*$'
However, when I bring this over to BASH it doesn't allow me to enter spaces.
I use the following code to produce a variable, which I then check if check is empty or not:
check=`echo $name | sed "s/\($isAlpha\)//"`
Any suggestions are greatly appreciated.
---------- Post updated at 07:52 PM ---------- Previous update was at 07:32 PM ----------
Sorry Scott,
When I say enter spaces I mean if I entered the following name:
John James Doe
That should be a valid match, but it isn't. Instead I have to enter
JohnJamesDoe (no spaces)
For it to be valid. I would like to be able to enter a name with a space (as in example 1)
In regards to the "remembered expression", I was following some online tutorials and that's how it showed me. If it is incorrect, I would appreciate it if you could show me the right way.
[Edit]: I did hit "post reply" but it just edited my main post and appeared to delete Scott's post... Sorry for the confusion.