Idea Regular expression method for finding code

Source: Internet
Author: User
Tags alphabetic character character classes uppercase letter

Find

The regular expression:

Initecharts *:{1} *\{{1}

The:

Initecharts  :  {

Where both sides of the colon allow unlimited spaces;


Note: Click the question mark to the right of the regex to see the rules for regular expressions, as follows:


Summary of Regular-expression constructs
Construct
Matches

Characters
X
The character X
\\
The backslash character
\0n
The character with octal value 0n (0 <= n <= 7)
\0nn
The character with octal value 0nn (0 <= n <= 7)
\0mnn
The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7)
\xhh
The character with hexadecimal value 0xhh
\uhhhh
The character with hexadecimal value 0xhhhh
\ t
The tab character (' \u0009 ')
\ n
The newline (line feed) character (' \u000a ')
\ r
The Carriage-return character (' \u000d ')
\f
The form-feed character (' \u000c ')
\a
The alert (Bell) character (' \u0007 ')
\e
The escape character (' \u001b ')
\cx
The control character corresponding to X

Character classes
[ABC]
A, B, or C (simple Class)
[^ABC]
Any character except A, B, or C (negation)
[A-za-z]
A through z or a through Z, inclusive (range)
[A-d[m-p]]
A through D, or M through P: [A-dm-p] (union)
[A-z&&[def]]
D, E, or F (intersection)
[A-Z&AMP;&AMP;[^BC]]
A through Z, except for B and C: [Ad-z] (subtraction)
[A-z&&[^m-p]]
A through Z, and not m through P: [A-lq-z] (subtraction)

Predefined character classes
.
Any character (could or may isn't match line terminators)
\d
A digit: [0-9]
\d
A non-digit: [^0-9]
\s
A whitespace character: [\t\n\x0b\f\r]
\s
A non-whitespace character: [^\s]
\w
A Word character: [a-za-z_0-9]
\w
A Non-word character: [^\w]

POSIX character classes (Us-ascii only)
\p{lower}
A lower-case alphabetic character: [A-z]
\p{upper}
An upper-case alphabetic character:[a-z]
\P{ASCII}
All ascii:[\x00-\x7f]
\p{alpha}
An alphabetic Character:[\p{lower}\p{upper}]
\p{digit}
A decimal digit: [0-9]
\p{alnum}
An alphanumeric character:[\p{alpha}\p{digit}]
\P{PUNCT}
Punctuation:one of! " #$%& ' () *+,-./:;=>[email protected][\]^_ ' {|} ~

\p{graph}
A visible character: [\p{alnum}\p{punct}]
\p{print}
A printable character: [\p{graph}\x20]
\p{blank}
A space or a tab: [\ t]
\p{cntrl}
A control character: [\x00-\x1f\x7f]
\p{xdigit}
A hexadecimal digit: [0-9a-fa-f]
\p{space}
A whitespace character: [\t\n\x0b\f\r]

Java.lang.Character classes (Simple Java Character type)
\p{javalowercase}
Equivalent to Java.lang.Character.isLowerCase ()
\p{javauppercase}
Equivalent to Java.lang.Character.isUpperCase ()
\p{javawhitespace}
Equivalent to Java.lang.Character.isWhitespace ()
\p{javamirrored}
Equivalent to java.lang.Character.isMirrored ()

Classes for Unicode blocks and categories
\p{ingreek}
A character in the Greek block (simple block)
\p{lu}
An uppercase letter (simple category)
\P{SC}
A currency symbol
\p{ingreek}
Any character except one in the Greek block (negation)
[\p{l}&&[^\p{lu}]
Any letter except a uppercase letter (subtraction)

Boundary matchers
^
The beginning of a line
$
The end of a line
\b
A Word Boundary
\b
A Non-word Boundary
\a
The beginning of the input
\g
The end of the previous match
\z
The end of the input but for the final terminator, if any
\z
The end of the input

Greedy quantifiers
X?
X, once or not at all
x*
X, zero or more times
x+
X, one or more times
X{n}
X, exactly n times
X{n,}
X, at least n times
X{N,M}
X, at least N and not more than m times

Reluctant quantifiers
X??
X, once or not at all
X*?
X, zero or more times
X+?
X, one or more times
X{n}?
X, exactly n times
X{n,}?
X, at least n times
X{n,m}?
X, at least N and not more than m times

Possessive quantifiers
x?+
X, once or not at all
x*+
X, zero or more times
X + +
X, one or more times
x{n}+
X, exactly n times
x{n,}+
X, at least n times
x{n,m}+
X, at least N and not more than m times

Logical operators
Xy
X followed by Y
X| Y
Either X or Y
X
X, as a capturing group

Back references
\ n
Whatever the nth capturing group matched

Quotation
\
Nothing, but quotes the following character
\q
Nothing, but quotes all characters until \e
\e
Nothing, but ends quoting started by \q


Special constructs (non-capturing)
(?: X)
X, as a non-capturing group
(? idmsux-idmsux)
Nothing, but turns match flags On-off
(? idmsux-idmsux:x)
X, as a non-capturing group with the given flags On-off
(? =x)
X, via Zero-width positive lookahead
(?! X
X, via Zero-width negative lookahead
(? <=x)
X, via Zero-width positive lookbehind
(? <! X
X, via Zero-width negative lookbehind
(? >x)
X, as an independent, non-capturing group
Regular expressions:full java Regular Expressions syntax description, Using Regular Expressions in Java.

Idea Regular expression method for finding code

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.