40-Multitrack TM, Pattern Matching-02-05-2024
40-Multitrack TM, Pattern Matching-02-05-2024
Theory of Computation
Lecture 32
Dr. Saritha Murali
(SCOPE, VIT Vellore)
02-05-2024
Multi-track Turing machine
• The dollar ( $ ) symbol It tells the computer that the match must
occur at the end of the string
• Example : -\d{3}$ will match with patterns like "-333" in "-901-333".
• Character Classes A character class matches any one of a set of
characters. It is used to match the most basic element of a language
like a letter, a digit, space, a symbol etc. /s : matches any whitespace
characters such as space and tab /S : matches any non-whitespace
characters /d : matches any digit character /D : matches any non-digit
characters /w : matches any word character (basically alpha-
numeric) /W : matches any non-word character /b : matches any
word boundary (this would include spaces, dashes, commas, semi-
colons, etc)
• [set_of_characters] – Matches any single character in
set_of_characters. By default, the match is case-sensitive.
• Example : [abc] will match characters a,b and c in any string.
• Mobile number