Regex for CAR- and CAR_


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Regex for CAR- and CAR_
# 1  
Old 01-29-2015
Regex for CAR- and CAR_

I am trying to find a Regex match for a string: CAR- and CAR_

So I need to match only the letters CAR or a / or a -. So if the word CAR ends in - I need to match it or if it ends in _ I need to match it.

Anyone know this regex?
# 2  
Old 01-29-2015
If you don't identify what is using the regular expression, the requirements will often vary. In this case:
CAR[-_]
will match either of these strings anywhere in a line or file or string in you need a basic regular expression or extended regular expression that can be used in many utilities; it will not work in a filename matching pattern unless the regular expression is intended to only match an entire filename.
This User Gave Thanks to Don Cragun For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed or revelent command to remove car

How to remove the digits. I need to check after / if I have more the 3 digit remove all including backslash Input file portshow 8/150800 portshow 9/150900 portshow 12/150c00 portshow 12/150 portshow 15/150f00 portshow 16/151000 portshow 17/151100 portshow 17/15... (6 Replies)
Discussion started by: ranjancom2000
6 Replies

2. Shell Programming and Scripting

Sendmail K command regex: adding exclusion/negative lookahead to regex -a@MATCH

I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works: LOCAL_CONFIG # Kcheckaddress regex -a@MATCH +<@+?\.++?\.(us|info|to|br|bid|cn|ru) LOCAL_RULESETS SLocal_check_mail # check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies

3. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

4. What is on Your Mind?

Man develops Car that runs using water as fuel

It's a metacafe video, doesn't work with tags. Here's the link Man Develops a Car Which Runs Solely on Water ! Video This is good news, I guess if water replaces oil we won't get a heart attack any more when we see fuel prices keep escalating because arabs and israeli's keep fighting. (1 Reply)
Discussion started by: sparcguy
1 Replies
Login or Register to Ask a Question