Langsung ke konten utama

Postingan

Menampilkan postingan dengan label Regex

Everything all about REGEX

 https://towardsdatascience.com/everything-you-need-to-know-about-regular-expressions-8f622fe10b03 Everything you need to know about Regular Expressions What is a Regular Expression? On an abstract level a regular expression, regex for short, is a shorthand representation for a set. A set of strings. Say we have a list of all valid zip codes. Instead of keeping that long and unwieldy list around, it’s often more practical to have a short and precise pattern that completely describes that set. Whenever you want to check whether a string is a valid zip code, you can match it against the pattern. You’ll get a true or false result indicating whether the string belongs to the set of zip codes the regex pattern represents. Let’s expand on the set of zip codes. A list of zip codes is finite, consists of rather short strings, and is not particularly challenging computationally. What about the set of strings that end in  .csv ? Can be quite useful when looking for data files. This set ...

Regex - Summary of regular-expression constructs

  Construct Matches     Characters x The character x \\ The backslash character \0 n The character with octal value 0 n  (0  <=   n   <=  7) \0 nn The character with octal value 0 nn  (0  <=   n   <=  7) \0 mnn The character with octal value 0 mnn  (0  <=   m   <=  3, 0  <=   n   <=  7) \x hh The character with hexadecimal value  0x hh \u hhhh The character with hexadecimal value  0x hhhh \x {h...h} The character with hexadecimal value  0x h...h  ( Character.MIN_CODE_POINT   <=  0x h...h  <=  Character.MAX_CODE_POINT ) \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' ) \c x The control character...