什麼是 regular expression or regex

as title

1 個解答

評分
  • p
    Lv 6
    1 十年前
    最愛解答

    Many unix/linux related utilities(vi, perl) and other languages (Java, SQL) use regular expressions to search for patterns.

    We write a 'pattern' to match for texts. The pattern can be simply a normal text, for example:

    /ABC/ will match 'As easy as ABC.', because the pattern ABC is present in the given string.

    On the other hand,

    /ABC/i will match any combination of cases, so a match will be found for

    'As easy as Abc' or 'As easy as abc'.

    Sometimes, to match only certain combinations of characters, we can use the character group:

    /[abc][ABC]/ will match any combination of one letter of a,b or c followed by A, B or C, such as aB, cA, aA, etc.

    It is a very interesting subject if you are in programming, or using utilities like Perl, awk, vi, sed, grep, Java or SQL.

    You can find more information at the following link:

    http://www.english.uga.edu/humcomp/perl/regex2a.ht...

還有問題嗎?立即提問即可得到解答。