• +91 9723535972
  • info@interviewmaterial.com

Regular Expressions Interview Questions and Answers

Regular Expressions Interview Questions and Answers

Question - 1 : - What is the mean of Regular Expressions?

Answer - 1 : -

Regular Expressions is a pattern which is used to search string like "Search name start with a" OR "Search name end with z".

Question - 2 : - What is Regular expressions?

Answer - 2 : -

-Regular expressions is used to perform powerful and efficient text processing

-It is simple like search editors and powerful text processing language

-This is powerful pattern language

-Matching performed based on the bit pattern used for the encoding the character not based graphic representation of the character

-Regualr expressions composed with two types of characters 

1)meta characters (like *)  

2)litrals 

Question - 3 : - How many types of Regex engines available ?

Answer - 3 : -

two types 

1)DFA
2)NFA

Question - 4 : - What are good regex concerns (or) principles?

Answer - 4 : -

1)Understanding the requirement properly 
2)Matching what you want 
3)Keeping the Regex manageable and understandable 

Question - 5 : - What is Anchors in Regular expressions?

Answer - 5 : -

Anchors not matching anything but pointing the positions in given data

There are two types of anchors 
1) Simple ones  (^ , $,\G ...etc)
2)Complex ones (lookbehind and lookahead)

Question - 6 : - What is the difference between ^ and \A in Regular expressions?

Answer - 6 : -

^ - Matches the starting of the line. Effecting the multiline mode
Ex: ^Bob
Bob is good
Bob is Nice

-> if used this in character class working as a negate character.
[^abc] - matching anything except a,b,c

\A -  Matches the starting of the line. Not effecting the multiline mode.
Ex: \ABob - Bob is good.

Question - 7 : - What is the difference between \Z and $ in Regular expressions?

Answer - 7 : -

\Z -  Matches the end of the line. Not effecting the multiline mode.
Ex: Shiva\Z
Gummadidal Shiva
Regex classes by Gummadidal Shiva

$ - Matches the end of the line.effecting the multiline mode.
Ex: Shiva$
Gummadidal Shiva
Regex classes by Shiva. Shiva is good teacher
Thanks to Shiva

[[:upper:]] - Matches capital letters is equal to [A-Z].
Ex: GUMMADIDALA shiva From Hyderabad,India

Question - 8 : - What is Character class in Regular expressions?

Answer - 8 : -

Character  class always match one character.
[abc]-alwaya match  either a or b or c.

Question - 9 : - What is ? (Or) optional character in Regular expressions?

Answer - 9 : -

Optional character is used to make charecter as optional, if character exist regex will match , if not ignoring the character
July?- is matching July or jul

Question - 10 : - What is the use of parentheses in Regular expressions?

Answer - 10 : -

Using parentheses perform two kind of functions 
1) grouping
2) capturing


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners