Sponsored Content
Full Discussion: Regex to match IP address
Top Forums UNIX for Advanced & Expert Users Regex to match IP address Post 302401447 by jim mcnamara on Saturday 6th of March 2010 07:03:33 AM
Old 03-06-2010
It is important to note -
the perl regex engine is not identical to the engine used for grep.

There are a lot of flavors of regex out there.

You may want to check out on google or find a copy of J Freidl's 'Mastering Regular Expressions':

nondeterministic finite-state automata NFA
deterministic finite-state automata DFA
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

regex to match basename

Hi Can somebody please help me know how do i match the basename using a regular expression using posix standard in shell script suppose i want to match /u01/Sybase/data/master.dbf the result should be master.dbf as i want to match everything after the last / regards (8 Replies)
Discussion started by: xiamin
8 Replies

2. Shell Programming and Scripting

Using SED command in a shell script: Unterminated address regex

Hi All, I am trying to use a sed command in a shell script in order to delete some lines in a file and I got the following error message. I don't understand why it is not working 'cause I have tried with simple quotes, then with double-quotes, and it is not working. sed: -e expression #1,... (7 Replies)
Discussion started by: Alpha3363
7 Replies

3. Shell Programming and Scripting

SED With Regex to extract Email Address

Hi Folks, In my program, I have a variable which consists of multiple lines. i need to use each line as an input. My intention is to extract the email address of the user in each line and use it to process further. The email address could be anywhere in the whole line. But there will be only... (5 Replies)
Discussion started by: ragz_82
5 Replies

4. Shell Programming and Scripting

Regex: Get the word before match

Hi Input: MYTEXT.aa.bb cc.MYTEXT.aa.bb ee.dd.cc.MYTEXT.aa.bb cc.NOTEXT.a.b Output: <empty> cc cc <empty> I would like to use a regex to extract the last word before MYTEXT without the dot (2 Replies)
Discussion started by: chitech
2 Replies

5. Shell Programming and Scripting

Regex to match only first occurence with grep

Hello to all, How would be the correct regex to match only the first occurence of the pattern 3.*6. I'm trying with 3.*6 trying to match only 34rrte56, but with my current regex is matching 4rrte567890123456789123powiluur56. And if I try with ? doesn't print anything echo... (6 Replies)
Discussion started by: Ophiuchus
6 Replies

6. Shell Programming and Scripting

Only Regex pattern match help

Hi We have a tool to monitor logs in our environment. The tool accepts log pattern match only using regex and I accept I am a n00b in that:confused:. I had been banging my head to make it work without much success and at last had to turn on to my last option to post it here. I had got great... (2 Replies)
Discussion started by: radioactive9
2 Replies

7. Shell Programming and Scripting

Sed: -e expression #1, char 16: unterminated address regex

I am trying to grep for a particular text (Do action on cell BL330) in a text file(sample.gz) which is searched in the content filtered by date+timestamp (2016-09-14 01:09:56,796 to 2016-09-15 04:10:29,719) on a remote machine and finally write the output into a output file on a local machine. ... (23 Replies)
Discussion started by: rbadveti
23 Replies

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

9. Shell Programming and Scripting

Mailq regex match

Hi, # mailq | awk '{match($0, /quota/)} {print $0}' | head -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- 9A6A7DE117E 84309 Sat Sep 30 14:14:50 alerts-noreply+xxxxx=xxx.sg@xxx.xx.xxx (host alt1.gmail-smtp-in.l.google.com said: 452-4.2.2 The email account that you... (2 Replies)
Discussion started by: ashokvpp
2 Replies

10. UNIX for Beginners Questions & Answers

Sed: -e expression #1, char 20: unterminated address regex

I am trying to add word in last of particular line. the same command syntex is running on prompt. but in bash script give error."sed: -e expression #1, char 20: unterminated address regex" Please help. for i in `cat servername`; do ssh -q -t root@$i sed -i '/simple_allow_groups =/s/$/,... (4 Replies)
Discussion started by: yash_message
4 Replies
grammar::fa::dacceptor(n)			       Finite automaton operations and usage				 grammar::fa::dacceptor(n)

__________________________________________________________________________________________________________________________________________________

NAME
grammar::fa::dacceptor - Create and use deterministic acceptors SYNOPSIS
package require Tcl 8.4 package require snit package require struct::set package require grammar::fa::dacceptor ?0.1.1? ::grammar::fa::dacceptor daName fa ?-any any? daName option ?arg arg ...? daName destroy daName accept? symbols _________________________________________________________________ DESCRIPTION
This package provides a class for acceptors constructed from deterministic finite automatons (DFA). Acceptors are objects which can be given a string of symbols and tell if the DFA they are constructed from would accept that string. For the actual creation of the DFAs the acceptors are based on we have the packages grammar::fa and grammar::fa::op. API
The package exports the API described here. ::grammar::fa::dacceptor daName fa ?-any any? Creates a new deterministic acceptor with an associated global Tcl command whose name is daName. This command may be used to invoke various operations on the acceptor. It has the following general form: daName option ?arg arg ...? Option and the args determine the exact behavior of the command. See section ACCEPTOR METHODS for more explanations. The acceptor will be based on the deterministic finite automaton stored in the object fa. It will keep a copy of the relevant data of the FA in its own storage, in a form easy to use for its purposes. This also means that changes made to the fa after the construction of the acceptor will not influence the acceptor. If any has been specified, then the acceptor will convert all symbols in the input which are unknown to the base FA to that symbol before proceeding with the processing. ACCEPTOR METHODS
All acceptors provide the following methods for their manipulation: daName destroy Destroys the automaton, including its storage space and associated command. daName accept? symbols Takes the list of symbols and checks if the FA the acceptor is based on would accept it. The result is a boolean value. True is returned if the symbols are accepted, and False otherwise. Note that bogus symbols in the input are either translated to the any symbol (if specified), or cause the acceptance test to simply fail. No errors will be thrown. The method will process only just that prefix of the input which is enough to fully determine (non-)acceptance. EXAMPLES
BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category gram- mar_fa of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
acceptance, acceptor, automaton, finite automaton, grammar, parsing, regular expression, regular grammar, regular languages, state, trans- ducer CATEGORY
Grammars and finite automata COPYRIGHT
Copyright (c) 2004 Andreas Kupries <andreas_kupries@users.sourceforge.net> grammar_fa 0.1.1 grammar::fa::dacceptor(n)
All times are GMT -4. The time now is 07:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy