Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

re_comp(3) [centos man page]

RE_COMP(3)						     Linux Programmer's Manual							RE_COMP(3)

NAME
re_comp, re_exec - BSD regex functions SYNOPSIS
#define _REGEX_RE_COMP #include <sys/types.h> #include <regex.h> char *re_comp(char *regex); int re_exec(char *string); DESCRIPTION
re_comp() is used to compile the null-terminated regular expression pointed to by regex. The compiled pattern occupies a static area, the pattern buffer, which is overwritten by subsequent use of re_comp(). If regex is NULL, no operation is performed and the pattern buffer's contents are not altered. re_exec() is used to assess whether the null-terminated string pointed to by string matches the previously compiled regex. RETURN VALUE
re_comp() returns NULL on successful compilation of regex otherwise it returns a pointer to an appropriate error message. re_exec() returns 1 for a successful match, zero for failure. ATTRIBUTES
Multithreading (see pthreads(7)) The re_comp() and re_exec() functions are not thread-safe. CONFORMING TO
4.3BSD. NOTES
These functions are obsolete; the functions documented in regcomp(3) should be used instead. SEE ALSO
regcomp(3), regex(7), GNU regex manual COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2013-06-21 RE_COMP(3)

Check Out this Related Man Page

RE_COMP(3)						     Linux Programmer's Manual							RE_COMP(3)

NAME
re_comp, re_exec - BSD regex functions SYNOPSIS
#define _REGEX_RE_COMP #include <sys/types.h> #include <regex.h> char *re_comp(char *regex); int re_exec(char *string); DESCRIPTION
re_comp() is used to compile the null-terminated regular expression pointed to by regex. The compiled pattern occupies a static area, the pattern buffer, which is overwritten by subsequent use of re_comp(). If regex is NULL, no operation is performed and the pattern buffer's contents are not altered. re_exec() is used to assess whether the null-terminated string pointed to by string matches the previously compiled regex. RETURN VALUE
re_comp() returns NULL on successful compilation of regex otherwise it returns a pointer to an appropriate error message. re_exec() returns 1 for a successful match, zero for failure. CONFORMING TO
4.3BSD. NOTES
These functions are obsolete; the functions documented in regcomp(3) should be used instead. SEE ALSO
regcomp(3), regex(7), GNU regex manual COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
1995-07-14 RE_COMP(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

unzip

Is there any way to uncompress files in winzip/pkzip format which contain mulitple members without using the "unzip" command? (9 Replies)
Discussion started by: keroppi
9 Replies

2. Shell Programming and Scripting

Substitutions in a file from list in a 2nd file

I made a rash statement yesterday that I could do this easier in Linux than on Windows with VBS but looking at it I'm a bit stuck. I have a large fixed-width data file auto-generated by a database for printing delivery labels that's full of tags and flags for the printers. I need to compare the... (8 Replies)
Discussion started by: fj1200
8 Replies

3. Shell Programming and Scripting

Perl regex question

I have the following code: #!/usr/bin/perl -w @files = <*.csv>; foreach $file (@files) { open(FH, $file) || die("Error: Cannot open file $file for reading."); my @dt = ($file =~ /^(\w+).(\d{6})\.csv$/); while (<FH>) { print "@dt $_\n"; } close(FH); } There is redundancy... (10 Replies)
Discussion started by: figaro
10 Replies

4. Shell Programming and Scripting

Quick regex question about alphabetic string

Hi guys, Pretty new to regex, and i know im doing something wrong here. I'm trying to get a regex command that restricts a string to be 8 characters long, and the first character cannot be 0. Here's what i have so far... echo "01234" | grep "^{8}*$" Thanks very much! -Crawf ... (7 Replies)
Discussion started by: crawf
7 Replies

5. Shell Programming and Scripting

Help with a perl subroutine regex

Hi, I can't get this script ot work and I wa wondering if anyone could help? I need to open a file and use a subroutine to search each line for a regular expression. If it matches then I need to return a match from the subroutine and print the result? Any help would be greatly... (11 Replies)
Discussion started by: jmd2004
11 Replies

6. Shell Programming and Scripting

printf / regex

Morning folks, I need help with the following issue: Let's say we I have the following output: First Name: Test Last Name: Test2 Number: T1234 Number2: T1234 Needed Output: T1234 Now I want to grep/nawk/printf/sed out the Number: (13 Replies)
Discussion started by: domi55
13 Replies

7. Shell Programming and Scripting

Perl regex help - matching parentheses

Let's say I'm trying to match potentially multiple sets of parentheses. Is there a way in a regular expression to force a match of closing parentheses specifically in the number of the opening parentheses? For example, if the string is "((foo bar))", I want to be able to say "match any number of... (7 Replies)
Discussion started by: cvp
7 Replies

8. Shell Programming and Scripting

egrep regex

Hi, I have a file with some words divided into syllables by the character "|" (pipe). For example zu|ri|ghe|se.I would like a regex that matches all the words that are not divided in syllables.All the word that have no "|" pipe character.I have thought at $echo "zu|ri|ghe|se" | grep '' ... (7 Replies)
Discussion started by: and77
7 Replies

9. Shell Programming and Scripting

Perl regex

I have got numbers like l255677 l376039 l188144 l340482 l440700 l254113 to match the numbers starting with '13' what would be the regex =~/13(.*)/ =======>This is not working .... But for user123,user657 regex =~/user(.*)/ ========>works Thanks for help..!! (7 Replies)
Discussion started by: trina_1
7 Replies

10. Shell Programming and Scripting

Shell script regex help: accept only 3 file extensions

This regex is supposed to accept files with extensions 270, 276, and "txt" only. Everything else should be discarded. This is what I have. I'll spare you the rest of the code. ext =".\$" #ext =".\$" #ext =".\$" #ext =".\$" for xfile in `ls $dir | grep "$ext" | xargs`; do... (9 Replies)
Discussion started by: grep01
9 Replies

11. Shell Programming and Scripting

Question on regex with * and .

I have a basic question regarding * and . while using regex: # echo 3 | grep ^*$ 3 I think I understood why it outputs "3" here (because '*' matches zero or more of the previous character) but I don't understand the output of the following command: # echo 3 | grep ^.$ # I thought I... (7 Replies)
Discussion started by: mirage
7 Replies

12. Shell Programming and Scripting

Script to put block comment after finding regex in xml file

hi, i need my bash script to find regex in xml file.. and comment 2 lines before and after the line that contains regex.. can't use # needs to be <!-- at the beginning and --> and the end of the comment. so eg.. first block <filter> <filter-name>MyRegEx</filter-name> ... (11 Replies)
Discussion started by: Poki
11 Replies

13. Shell Programming and Scripting

Every regex tp new file

Hi, I have a file like this- regex 1 2 regex 2 4 5 regex 4 6 8 regex how do I split each interval to a new file? something like- file1-1 2 file2-2 (7 Replies)
Discussion started by: jamie_123
7 Replies

14. Shell Programming and Scripting

How to get next 3 lines after regex?

HI, Just wanted to get some advice on how i can get the next 3 lines after a regex: Say i have a file which contains something like below: client467 master tcp ether tor0141 4467 query tcp ether tor0141 4467 client468 master tcp ether tor2141 4468 ... (17 Replies)
Discussion started by: reignangel2003
17 Replies

15. Shell Programming and Scripting

Grep with regex containing one string but not the other

Hi to you all, I'm just struggling with a regex problem and I'm pretty sure that I'm missing sth obvious... :confused: I need a regex to feed my grep in order to find lines that contain one string but not the other. Here's the data example: 2015-04-08 19:04:55,926|xxxxxxxxxx| ... (11 Replies)
Discussion started by: stresing
11 Replies