In computing, regular expressions, also referred to as regex or regexp, provide a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. A regular expression is written in a formal language that can be interpreted by a regular expression processor, a program that either serves as a parser generator or examines text and identifies parts that match the provided specification.
The following examples illustrate a few specifications that could be expressed in a regular expression:
Regular expressions can be much more complex than these examples.
For more information, you can visit the following link 
If you want to test your own regular expression with a sample text, visit the following link 
import re _regExpReq=r"(?P<nodeId>\S*) (?P<remoteHost>\S*) (?P<remoteLogname>\S*) (?P<remoteUser>\S*) \[(?P<time>.*)\] \"(?P<firstLineofRequest>\S* \S*) \S*\" (?P<finalStatus>\S*) (?P<responseSize>\S*) (?P<responseTime>\S*) \"(?P<referer>[^\"]*)\" \"(?P<userAgent>[^\"]*)\" \"(?P<xForwardedFor>[^\"]*)\".*" prog=re.compile(_regExpReq) for line in file: result=prog.match(line) if result!=None: #parse the service name (considering the GET ... special service name) if len(result.group('firstLineofRequest').split("="))>1: pre_service=result.group('firstLineofRequest').split("=")+"="+result.group('firstLineofRequest').split("=") else: pre_service=result.group('firstLineofRequest').split("=")
Still have questions? We can help. Submit a case to Technical Support.