REGEX(3) Library Functions Manual REGEX(3)NAME
re_comp, re_exec - regular expression handler
SYNOPSIS
char *re_comp(s)
char *s;
re_exec(s)
char *s;
DESCRIPTION
Re_comp compiles a string into an internal form suitable for pattern matching. Re_exec checks the argument string against the last string
passed to re_comp.
Re_comp returns 0 if the string s was compiled successfully; otherwise a string containing an error message is returned. If re_comp is
passed 0 or a null string, it returns without changing the currently compiled regular expression.
Re_exec returns 1 if the string s matches the last compiled regular expression, 0 if the string s failed to match the last compiled regular
expression, and -1 if the compiled regular expression was invalid (indicating an internal error).
The strings passed to both re_comp and re_exec may have trailing or embedded newline characters; they are terminated by nulls. The regular
expressions recognized are described in the manual entry for ed(1), given the above difference.
SEE ALSO ed(1), ex(1), egrep(1), fgrep(1), grep(1)DIAGNOSTICS
Re_exec returns -1 for an internal error.
Re_comp returns one of the following strings if an error occurs:
No previous regular expression,
Regular expression too long,
unmatched (,
missing ],
too many () pairs,
unmatched ).
3rd Berkeley Distribution May 15, 1985 REGEX(3)
Check Out this Related Man Page
regex(3) Library Functions Manual regex(3)Name
re_comp, re_exec - regular expression handler
Syntax
char *re_comp(s)
char *s;
re_exec(s)
char *s;
Description
The subroutine compiles a string into an internal form suitable for pattern matching. The subroutine checks the argument string against
the last string passed to
The subroutine returns 0 if the string s was compiled successfully; otherwise a string containing an error message is returned. If is
passed 0 or a null string, it returns without changing the currently compiled regular expression.
The subroutine returns 1 if the string s matches the last compiled regular expression, 0 if the string s failed to match the last compiled
regular expression, and -1 if the compiled regular expression was invalid (indicating an internal error).
The strings passed to both and may have trailing or embedded newline characters; they are terminated by nulls. The regular expressions
recognized are described in the manual entry for given the above difference.
Diagnostics
The subroutine returns -1 for an internal error.
The subroutine returns one of the following strings if an error occurs:
No previous regular expression
Regular expression too long
unmatched (
missing ]
too many () pairs
unmatched )
See Alsoed(1), ex(1), egrep(1), fgrep(1), grep(1)regex(3)
Hi, I would like to set up a Posix string to match the subject line in spam e-mails which contain
""
How do I get the square brackets recognised as literals and then include them in a string so that I can reject spam with things like in the subject line. (11 Replies)
Hi,
I have a string like this-->"After Executing service For 10 Request"
in this string i need to extract "10".
the contents of the string is variable and "10" appears before "For" and after "Request" i.e, in this format "For x Request"
I need to extract the value of x. How to do this in AWK?... (10 Replies)
Hi,
Could anybody explain why will evaluate to true for a string that is not null, not empty string, and has at least one non-space char?
My understanding is that ^ means exclude all chars inside . So I thought it should mean anything except space.
This seems a big mystery to me. (9 Replies)
Hi guys,
can any one tell me how to create directories using regular expression?
Let's say that I need to create directories test01, test02, test03.... test10.
Can it be done using any regular expression?
thanks. (13 Replies)
Hi all,
I am processing a file with awk that looks like this:
"
0.0021 etc
0.0123 etc
0.1234 etc
...
0.5324 etc
0.5434 etc
0.6543 etc
...
1.0344 etc
1.1344 etc
...
1.5345 etc
1.5632 etc
"
I need to print out only the lines that have '0' or '5' after the comma, plus I need only... (11 Replies)
Hello all,
I read somewher that regular expressions work with ASCII table so when i type
grep "*" file_name
it uses values from ACII dec97(a) to dec122(z), right ?
But if I have file containing diacritics, lets say (ordinary Slovak language characters):
marek@cepi:~$ cat diakritika ... (9 Replies)
Hi,
I am executing a svnlook command to check to see if the following line exists. I need a regular expression to represent the line.
A /test/test1/qa/test2/index.html
A /test/test1/qa/test3/test.jpg
A /test/test1/qa/test3/test1.jpg
A /test/test1/qa/test4/test.swf
I just need to extract... (9 Replies)
Hi ,
I am having an issue with the Awk script to insert newline for a regular expression match
Having a file like this
FILE1
####################
RXOER , RXERA , RXERC , RXERD
.RXEA(RXBSN), RXERD , REXCD
input RXEGT
buffer RXETRY
#######################
Want to match the RXE... (38 Replies)
I trying to match the begining of the following line in a perl script with a regular expression.
$ENV{'ORACLE_HOME'}
I tried this regluar expession:
/\$ENV\{\'ORACLE_HOME\'\}/
Instead of match, I got a blank prompt >
It seems to be a problem with the single quote. If I take it... (11 Replies)
I have an input file which looks like the example below and I want to format it with 2 columns from the header based on the word "CUSIP" followed by a 9 digit string with first 3 being numeric and in the same line NNN.NN% pattern for the percentage value. (In RED)
I started of with nawk but... (12 Replies)
Experts and Informed folks,
Need some help here in parsing the log file.
1389675 Opera_ShirtCatalog INSERT INTO Opera_ShirtCatalog(COL1, COL2) VALUES (1, 'TEST1'), (2,'TEST2');
1389685 Opera_ShirtCatlog_Wom INSERT INTO Opera_ShirtCatlog_Wom(col1, col2, col3) VALUES (9,'Siz12, FormFit',... (12 Replies)
Hello All,
I'm trying to extract the lines between two consecutive elements of an array from a file.
My array looks like:
problem_arr=(PRS111 PRS213 PRS234)
j=0
while } ]
do
k=`expr $j + 1`
sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt
---some operation goes... (11 Replies)
Hi,
I am quite knew to scripting and I am trying to get a regular expression to work to check that a user enters a valid version number such as 1 or 1.1 or 12.3 etc. I dont seem to be able to get it to work as it picks up versions such as 1.......2. I only want it to work with a single dot.... (12 Replies)
Hi,
temp="/usr=25,/usr/lib=12"
How to get only dir names with out values.
I tried like below but no use.
tmp=${temp##*,}
echo $tmp
o/p:
/usr/lib=12
expected o/p:
/usr /usr/lib ---> in array (13 Replies)