|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | 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. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
using regular expressions in c shell control structure
i cant get around using regular expressions in if/else statements. it simply doesnt give me the right results.
i've tried using switch/case but that is just as sh!tty as well. (pardon my french but im getting frustrated with c shell..only reason why im writing in it is because it's a hwk assignment to compare bourne with c shell) anyways im trying to write a regular expression that says a string must begin with A have any number of [d-f] in between and end with B so what i got is basically this.. ========= echo -n "Enter a string: " set $string = $< if ($string =~ '^A[d-f]*B$') then echo "accepted" else echo "rejected" endif exit ========== it simply doesnt work cshell doesnt seem to like the anchors or other special characters. any feedback would be greatly appreciated. |
| Sponsored Links |
|
|
|
|||
|
sorry. however, that piece of code is just 5% of my assignment as a whole. and i'm not posting my assignment and asking somebody to do it for me, i have something and i'm asking for advise on how to get it to work. i cant see how most ppl in here arent asking questions related to their assignments.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| regex, regular expressions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Execute a shell script using regular expressions | supergirl3954 | UNIX for Dummies Questions & Answers | 1 | 02-28-2008 11:20 AM |
| regular expressions | jack1981 | Shell Programming and Scripting | 4 | 07-12-2006 04:10 PM |
| Regular Expressions | sandeep_hi | Shell Programming and Scripting | 6 | 06-12-2006 03:12 AM |
| Regular Expressions | AresMedia | Shell Programming and Scripting | 1 | 08-22-2002 04:55 PM |
| Regular Expressions in shell scripts <yawn> | sam_pointer | UNIX for Dummies Questions & Answers | 3 | 09-04-2001 06:30 PM |