![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| regex test in bash | subin_bala | Shell Programming and Scripting | 1 | 04-16-2008 03:27 AM |
| test command looks strange... | jjinno | Shell Programming and Scripting | 2 | 11-02-2007 07:31 PM |
| Help regarding Error message: A test command parameter is not valid | skyineyes | Shell Programming and Scripting | 5 | 06-29-2007 05:38 AM |
| a strange message when executing the sort command | marwan | UNIX for Dummies Questions & Answers | 3 | 04-27-2007 07:32 AM |
| ed strange error message | frenki | Shell Programming and Scripting | 6 | 10-29-2004 06:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Strange error message with regex test...
Hi all,
I have a script where i need to check the format of a string. finally, i'm waiting a "process name" and 2 numbers separated by a "," string like : "this_is_a_string.txt,1,10 should be ok" string ok : "apache.exe,1,10" string ok : "mysqld,50,0" string not ok : "ap ache,1,10" string not ok : "ap,ache,1,10" string not ok : " apache,1,10" PS : "" characters are only here to be able to show a string beginning with a space... Here is what i tryed : if [[ $(expr "$PROCESS_STRING" : '^[a-z0-9\-\.\_]*,[0-9]*,[0-9]*$') -ne 0 ]]; then echo " : String OK" else echo " : String KO" fi But i always get an error : expr: WARNING: BRE not portable: « ^[a-z0-9\-\.\_]*,[0-9]*,[0-9]*$ »: use of « ^ » character as first character of a base regular expression isn't portable; canceled. : Format OK The problem seems to be the "^" character at the beginning of my regex, but if i remove it, a string like " apache,1,10" would be ok but it shouldn't in my case... thanks for your help Florent |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|