Friday, January 22, 2021

Wildcard | Character Sets | Meta Sequences

 

Wildcard: It matches any characters from characters to numbers and alphanumeric variables.




Character Sets:

For example, say we want to match phone numbers in a large document. we know that the numbers may contain hyphens, plus symbol etc. (e.g. +91-9925417854) , but it will not have any alphabet. we need to specify that we need only for numerics and some other symbols, but avoid alphabets.

 To handle such situations, we can use character sets in regular expressions


Meta Sequences:

We commonly use sets to match only digits, only alphabets, only alphanumeric characters, only whitespaces, etc. Therefore, there is a shorthand way to write commonly used character sets in regular expressions. These are called as meta-sequences




No comments:

Post a Comment

Element wise operation on LIST vs ARRAY

The use of arrays over lists: You can write  vectorised  code on numpy arrays, not on lists, which is  convenient to read and write, and con...