Sponsored Content
Full Discussion: Regex for this
Top Forums UNIX for Beginners Questions & Answers Regex for this Post 303036554 by utkarshkhanna44 on Tuesday 2nd of July 2019 05:09:27 AM
Old 07-02-2019
I am actually searching for this substring .V30M and storing the whole string if the string is like this : .V30M ( any_thing_here )
The above Regex matches .V30M ( 1'b1 ) but doesn't find this : .V30M ( SYNOPSYS_UNCONNECTED_99 )
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regex

Hi, i want to match a string using perl that has got 5 pluses(+++++). i am using a function for this. $str1="+++++"; check($str1,"\\+"); sub check{ $str1=$_; $str2=$_; if($str1=~m/^$str2{5}$/){ print "Correct.\n"; }else{ print "Wrong..\n"; ... (6 Replies)
Discussion started by: deepakpv
6 Replies

2. Shell Programming and Scripting

Need a regex

Hi, I am trying to grep for the following type of string from a document given below: 12637 1239 3356 12956 7004 7004 7004 13381 13381 *> 12.0.1.63 0 7018 21872 ? * 208.51.134.254 53 0 3549 7018 21872 ?... (1 Reply)
Discussion started by: Legend986
1 Replies

3. UNIX for Dummies Questions & Answers

regex

Can anyone give the detailed explanation on regex search i want to know the use of regex in sed and awk also...... the operators like ^,.,* ....etc i need it with some example.....kindly help on this. I gone through the man pages also..but i was not clear......... (1 Reply)
Discussion started by: sivakumar.rj
1 Replies

4. Shell Programming and Scripting

regex help

I would like to search strings composed by only one type of charachter for example only strings composed by the charachter 'b' is it right? $egrep '\<(b+)+\>' filename Could be there some side effects? Regards. (1 Reply)
Discussion started by: and77
1 Replies

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

6. Shell Programming and Scripting

Regex for First and Last name

I have a regex I'd like to implement and I believe it should be working and I have tested it on various websites that have regex testers but it always says the name is invalid. #!/bin/bash -x echo Enter the users first and last name. read name if... (11 Replies)
Discussion started by: woodson2
11 Replies

7. UNIX for Dummies Questions & Answers

read regex from ID file, print regex and line below from source file

I have a file of protein sequences with headers (my source file). Based on a list of IDs (which are included in some of the headers), I'd like to print out only the specified sequences, with only the ID as header. In other words, I'd like to search source.txt for the terms in IDs.txt, and print... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

8. Shell Programming and Scripting

Perl, RegEx - Help me to understand the regex!

I am not a big expert in regex and have just little understanding of that language. Could you help me to understand the regular Perl expression: ^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{ ------ This is regex to select functions from a C/C++ source and defined in... (2 Replies)
Discussion started by: alex_5161
2 Replies

9. UNIX for Beginners Questions & Answers

Using Regex

Here i am writing a script to check&display only the valid mail address from a file echo "Plz enter the Target file name with path" read path if then echo "The valid mail address are:" email=$(grep -E -o "\b+@+\.{2,6}\b" $path ) echo "$email" fi The file contains the data like this:... (6 Replies)
Discussion started by: Meeran Rizvi
6 Replies

10. 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
REGEX(3)						     Linux Programmer's Manual							  REGEX(3)

NAME
regcomp, regexec, regerror, regfree - POSIX regex functions SYNOPSIS
#include <sys/types.h> #include <regex.h> int regcomp(regex_t *preg, const char *regex, int cflags); int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size); void regfree(regex_t *preg); DESCRIPTION
POSIX Regex Compiling regcomp() is used to compile a regular expression into a form that is suitable for subsequent regexec() searches. regcomp() is supplied with preg, a pointer to a pattern buffer storage area; regex, a pointer to the null-terminated string and cflags, flags used to determine the type of compilation. All regular expression searching must be done via a compiled pattern buffer, thus regexec() must always be supplied with the address of a regcomp() initialized pattern buffer. cflags may be the bitwise-or of one or more of the following: REG_EXTENDED Use POSIX Extended Regular Expression syntax when interpreting regex. If not set, POSIX Basic Regular Expression syntax is used. REG_ICASE Do not differentiate case. Subsequent regexec() searches using this pattern buffer will be case insensitive. REG_NOSUB Support for substring addressing of matches is not required. The nmatch and pmatch arguments to regexec() are ignored if the pat- tern buffer supplied was compiled with this flag set. REG_NEWLINE Match-any-character operators don't match a newline. A nonmatching list ([^...]) not containing a newline does not match a newline. Match-beginning-of-line operator (^) matches the empty string immediately after a newline, regardless of whether eflags, the execu- tion flags of regexec(), contains REG_NOTBOL. Match-end-of-line operator ($) matches the empty string immediately before a newline, regardless of whether eflags contains REG_NOTEOL. POSIX Regex Matching regexec() is used to match a null-terminated string against the precompiled pattern buffer, preg. nmatch and pmatch are used to provide information regarding the location of any matches. eflags may be the bitwise-or of one or both of REG_NOTBOL and REG_NOTEOL which cause changes in matching behavior described below. REG_NOTBOL The match-beginning-of-line operator always fails to match (but see the compilation flag REG_NEWLINE above) This flag may be used when different portions of a string are passed to regexec() and the beginning of the string should not be interpreted as the begin- ning of the line. REG_NOTEOL The match-end-of-line operator always fails to match (but see the compilation flag REG_NEWLINE above) Byte Offsets Unless REG_NOSUB was set for the compilation of the pattern buffer, it is possible to obtain substring match addressing information. pmatch must be dimensioned to have at least nmatch elements. These are filled in by regexec() with substring match addresses. Any unused structure elements will contain the value -1. The regmatch_t structure which is the type of pmatch is defined in <regex.h>. typedef struct { regoff_t rm_so; regoff_t rm_eo; } regmatch_t; Each rm_so element that is not -1 indicates the start offset of the next largest substring match within the string. The relative rm_eo element indicates the end offset of the match, which is the offset of the first character after the matching text. Posix Error Reporting regerror() is used to turn the error codes that can be returned by both regcomp() and regexec() into error message strings. regerror() is passed the error code, errcode, the pattern buffer, preg, a pointer to a character string buffer, errbuf, and the size of the string buffer, errbuf_size. It returns the size of the errbuf required to contain the null-terminated error message string. If both errbuf and errbuf_size are nonzero, errbuf is filled in with the first errbuf_size - 1 characters of the error message and a terminating null. POSIX Pattern Buffer Freeing Supplying regfree() with a precompiled pattern buffer, preg will free the memory allocated to the pattern buffer by the compiling process, regcomp(). RETURN VALUE
regcomp() returns zero for a successful compilation or an error code for failure. regexec() returns zero for a successful match or REG_NOMATCH for failure. ERRORS
The following errors can be returned by regcomp(): REG_BADBR Invalid use of back reference operator. REG_BADPAT Invalid use of pattern operators such as group or list. REG_BADRPT Invalid use of repetition operators such as using '*' as the first character. REG_EBRACE Un-matched brace interval operators. REG_EBRACK Un-matched bracket list operators. REG_ECOLLATE Invalid collating element. REG_ECTYPE Unknown character class name. REG_EEND Non specific error. This is not defined by POSIX.2. REG_EESCAPE Trailing backslash. REG_EPAREN Un-matched parenthesis group operators. REG_ERANGE Invalid use of the range operator, e.g., the ending point of the range occurs prior to the starting point. REG_ESIZE Compiled regular expression requires a pattern buffer larger than 64Kb. This is not defined by POSIX.2. REG_ESPACE The regex routines ran out of memory. REG_ESUBREG Invalid back reference to a subexpression. CONFORMING TO
POSIX.1-2001. SEE ALSO
grep(1), regex(7) COLOPHON
This page is part of release 3.27 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
2008-05-29 REGEX(3)
All times are GMT -4. The time now is 11:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy