Pattern Matching
Hi,
I'm trying to perform a pattern matching task in a bash script. However, I'm just not getting the hang of it. I need to check that a variable is in the format of SURNAME, firstname or SURNAME, Firstname can anyone help with this? thanks. |
This is an area of knowledge still on my to-do list, but this website might help:
http://www.regular-expressions.info/tutorial.html |
How are you testing for this? ie are you using bash (=~) or another command like sed? Its not that the regex will be all that different but it helps
when presenting you options. Maybe also show us what you have tried. |
is this a situation, where if the variable is not in that format, its made to be in that format?
i dont understand where youre coming from with this, but it seems a simple Perl script could help you out, i just dont understand how you would distinguish from a surname and a firstname, unless you have some form of dictionary check, or its just literally "UPPERCASENAME, l(L)owercasename" , but where are the names being read from? user input? |
Thanks for that everyone,
I went with parsing on ", didn't think of that one. |
All times are GMT -5. The time now is 09:31 AM. |