Regex not working


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Regex not working
# 8  
Old 10-11-2013
I am using CVS installed on AIX. There is a file called commitinfo in CVS which recognizes the regular expression entries. Below is the link to description of the commitinfo file and its usage in CVS.

HTML Code:
http://durak.org/sean/pubs/software/cvsbook/The-commitinfo-And-loginfo-And-rcsinfo-Files.html
I have projects in CVS listed like below

Code:
abcd
adcdef
abcdefgh

I have a script that would lock projects.(lock.sh)

In the CVS commitinfo file I have entry like below

Code:
^abcd /path/to/lock.sh

The problem is the above entry is supposed to only lock project abcd but it is locking all the other 2 projects.

I tried

Code:
^abcd$ /path/to/lock.sh

and
Code:
^a.d$ /path/to/lock.sh

did not work ..Smilie

Last edited by Scrutinizer; 10-11-2013 at 10:59 PM.. Reason: extra code tags
# 9  
Old 10-11-2013
Also give a try to:
Code:
echo abcdefg|grep ^abc..fg$

what do you get ? Smilie

What do you mean by "locking" ?
Show what you are doing as well as the relevant section of code otherwise people won't be able to provide help accurrately
# 10  
Old 10-11-2013
abcdefg :-)
# 11  
Old 10-11-2013
Quick googling finds
^abcd\(/\|$\)
means it can end with a / or a line end.
BTW a . is one character while
.* is any amount of characters. A previous post put this wrong.
# 12  
Old 10-11-2013
Quote:
Originally Posted by gaurav99
I am using CVS installed on AIX. There is a file called commitinfo in CVS which recognizes the regular expression entries. Below is the link to description of the commitinfo file and its usage in CVS.

HTML Code:
http://durak.org/sean/pubs/software/cvsbook/The-commitinfo-And-loginfo-And-rcsinfo-Files.html
I have projects in CVS listed like below

Code:
abcd
adcdef
abcdefgh

I have a script that would lock projects.(lock.sh)

In the CVS commitinfo file I have entry like below

Code:
^abcd /path/to/lock.sh

The problem is the above entry is supposed to only lock project abcd but it is locking all the other 2 projects.

I tried

Code:
^abcd$ /path/to/lock.sh

and
Code:
^a.d$ /path/to/lock.sh

did not work ..Smilie
What did not work? Those projects, are they directories at the top of your repository?



--
@MadeInGermany: \| is a GNU extension to BRE (Basic Regular Expression)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

How to make working this regex in perl?

Hello to all, The Regex below is supposed to match all strings except RR45. I've tested in regex101.com and it works, butwhen I try to use it with the perl command below I get the error shown. Regex=(?<=^|RR45)(?!RR45).+?(?=RR45|$) How to fix this? I'm using Cygwin. $ echo... (9 Replies)
Discussion started by: Ophiuchus
9 Replies

3. Shell Programming and Scripting

If statement with [[ ]] and regex not working as expected

Using BASH: $ if -- ::00" ]]; then echo "true"; else echo "false"; fi false Mike (5 Replies)
Discussion started by: Michael Stora
5 Replies

4. UNIX for Dummies Questions & Answers

Gsub regex not working

I have a number of files that I pass through awk/gsub. I believe to have found a working regex and on 'test bed' sites it matches, however within gsub it does not. Examples: Initial data: /Volumes/Daniel/Public/Drop Box/_Hellsing_Ultimate_OVA_-_10_.mkv gsub & regex: gsub("\]+\]","" ... (4 Replies)
Discussion started by: unknownn
4 Replies

5. Shell Programming and Scripting

need to grep contents of a file within specific time span. regex i am using is not working

Hi , I am trying to extract contents of a file between specified time stamp. but it does not seem to work. i am trying to extract output of /var/adm/messages between 15:00:00 to 15:23:59 . i have tried two regex the first one seems to kind of work. it displays some output. the second one is... (13 Replies)
Discussion started by: chidori
13 Replies

6. Shell Programming and Scripting

matching a regex using egrep not working

Hi, I'm trying to validate if a string matches a regular expression, but it is not working. Am I missing something? Do I need to scape any of the characters? if echo 'en-GB' | egrep '({1,8})(-{1,8})*' >/dev/null; then echo Valid value fi Thanks in advance (6 Replies)
Discussion started by: skrtxao
6 Replies

7. 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

8. Shell Programming and Scripting

bash with: if, elif & regex not working

Why is only hello3 being printed? There must be some kind of syntax problem because the file list definitely includes all the file extensions line by line. #!/bin/bash find '/home/myuser/folder/' -name '*.c' -type f | while read F do if ] # if the file name ends in .txt.c then ... (6 Replies)
Discussion started by: cyler
6 Replies

9. Shell Programming and Scripting

BASH regex (convert from working perl version)

Hi there, I need to test that a variable ($VAR) matches a regex mask in BASH. I have the exact thing working in perl (below), but could somebody advise me how i would do the same in BASH ? do i need to use something like egrep ? #!/bin/perl -w my $VAR = "some value"; if ( $VAR =~... (4 Replies)
Discussion started by: rethink
4 Replies

10. Shell Programming and Scripting

gnu sed regex grouping not working?

Hello, from the gnu sed manual, I should be able to do this: `\(REGEXP\)' Groups the inner REGEXP as a whole, this is used to: * Apply postfix operators, like `\(abcd\)*': this will search for zero or more whole sequences of `abcd', while `abcd*' ... (3 Replies)
Discussion started by: Allasso
3 Replies
Login or Register to Ask a Question