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(const char *regex);
int re_exec(const 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
For an explanation of the terms used in this section, see attributes(7).
+---------------------+---------------+-----------+
|Interface | Attribute | Value |
+---------------------+---------------+-----------+
|re_comp(), re_exec() | Thread safety | MT-Unsafe |
+---------------------+---------------+-----------+
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 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
GNU 2017-09-15 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(const char *regex);
int re_exec(const 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
For an explanation of the terms used in this section, see attributes(7).
+---------------------+---------------+-----------+
|Interface | Attribute | Value |
+---------------------+---------------+-----------+
|re_comp(), re_exec() | Thread safety | MT-Unsafe |
+---------------------+---------------+-----------+
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 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
GNU 2017-09-15 RE_COMP(3)
Hello!
I have problems with syntax...
I want a variable, that contains regex... is it possible?
Like $ a='.+->.+' and then use it in index ($0, "a").
I guess it won't work...
thank you :) (4 Replies)
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)
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)
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)
Hi all
I am struggling to find out the capturing regex of a date format such as 10/12/2009. Also I need help on how to assign the date(i.e, 10/12/2009 ) to a variable after the match is found using the capturing regex.
Any help is appreciated. Thanks in advance. (5 Replies)
Need some help with a regex if loop problem.
File1:
2323
3232
4230
3230
4340
4343
233
32320
I want to print "Zero" if the number ends with a zero, but print "number" if it does not!
#!/bin/bash
/usr/bin/nawk '{
if ($1 ==/+0\b/){
print "Zero"}
else{
print "number"} (5 Replies)
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)
I want to match the red portion:
9784323456787-Unknown Phrase with punctuation "Some other PhrASE."
Is this the best regex to match this?
'978\{10\}-*' (4 Replies)
Must be a bug or something. Whether I escape them or not, it will not work. No matter what I set the minimum and maximum to nothing gets caught. For instance:
find / -regex "/.{0, 50}.*" -maxdepth 1 or find / -regex "/.\{0, 50\}.*" -maxdepth 1 should pretty much catch everything residing within... (4 Replies)
I have a requirement - replace specified positions in a string with a character. I found perl regex useful for this approach. however, I am facing the following issue.
The target file 'temp' contains -
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The goal is to convert... (5 Replies)
Hi,
Please help me to understand the bold segments in the below regex.
Both are of same type whose meaning I am looking for.
find . \( -iregex './\{6,10\}./src' \) -type d -maxdepth 2
Output:
./20111210.0/src
In continuation to above:
sed -e 's|./\(*.\{1,3\}\).*|\1|g'
Output: ... (4 Replies)
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)
Hi Experts,
I am using ls with regex in the below manner:
VAR="*.txt *.TXT"
ls -l $VAR
This is working fine if I have both txt and TXT extension files in my directory. But if any of them is not present, its throwing errors, that *.TXT file not found in the directory. So what am i missing... (6 Replies)
Fairly straightforward, but I'm having an awful time getting what I thought was a simple regex to work. I'll give the command I was playing with, and I'm aware why this one doesn't work (the 1,3 is off the A-Z, not the whole expression), I just don't know what the fix is:
Actual Output(s):
$... (5 Replies)