Linux Regular Expressions-wildcard characters

Source: Internet
Author: User

Wildcard OFDM character or period (.) is considered to be equivalent to a variable. A variable represents any value in an arithmetic expression. In a regular expression, a period (.) is a wildcard character that represents any character except newline characters (in awk, a period can even match an inline newline character).

Assuming that we are describing a sequence of characters, use the wildcard OFDM character to specify a position where any character can be populated.
For example, if you want to soso a discussion file that contains an Intel system microprocessor, use the following regular expression:
80.86
Will match the containing sequence "80286,", "80386," or "80486." The line. To match a decimal point or period, you must escape the point with a backslash.

It is useless to match only any character at the beginning or end of a pattern. Therefore, a wildcard character is usually placed before or after a character or other meta-character. For example, the following regular expression is written to search for a sequence of chapter:
Chapter.
It searches for "' chapter ' followed by a string with any character". In some searches, this expression may have the same match as a fixed string pattern "chapter". Take a look at the following example:

$ grep' Chapter. 'Sample
You'll find several examplesinchChapter9.
"Quote me ' Chapter and Verse ',"She said.
Chapter Ten

The shown column matches the "chapter" string, and using "chapter" will also match the same line. However, there is a different case where "chapter" appears at the end of the line.

Reference: http://www.linuxawk.com/communication/404.html

Linux Regular Expressions-wildcard characters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.