Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Different regular expression flavors

Answer»

Below are the different reular expressions flavors
(1)Text Patterns and Matches
(2)Literal Characters
(3)Character Classes or Character Sets
(4)Shorthand Character Classes
(5)Non-Printable Characters
(6)The Dot Matches (Almost) Any Character
(7)Anchors
(8)ALTERNATION
(9)Repetition
(10)Greedy and Lazy Repetition
(11)GROUPING and CAPTURING
(12)Backreferences
(13)Named Groups and Backreferences
(14)Unicode Properties
(15)Lookaround
(16)Free-Spacing Syntax

2.

Some basic topics and tips for Regex

Answer»

Below are the basic topics and tips for Regex with examples
(1)^The- Its matches and string that starts with the
Example:- The crackyourinterview sites has regex values

(2)End$- Its matches a string that ends with world End
Example:- this is now end

(3)^The End$-Its matches a string that start with "The" and end with "End"
Example:- The data in crackyourinterview has End

(4)data- Its matches the world given
Example:- Crackyourinterview have data in it

Quantifiers? ?* + ? and {}

(5)abc*- Its matches string that has ab followed by zero or more c
Example:- ab,abc,abcc,abccc

(6)abc+- Its matches string that has ab followed by 1 or more c
Example:- abc,abcc,abcc

(7)abc?- Its matches string that has ab followed by zero or one c
Example:- ab,abc

(8)abc{2}- Its matches string that has ab followed by two c
Example:-abcc

(9)abc{2,}- Its matches string that has ab followed by two or more c
Example:-abcc,abccc

(10)abc{2,5}- Its matches string that has ab followed by two upto 5 c
Example:-abcc,abccc,abccccc

(11)a(bc)*- Its matches string that has followed by zero or more COPIES of sequence bc
Example:-abcbc,abcbcbc

(12)a(bc){2,5}- Its matches string that has followed by zero or more copies of sequence bc from 2 to 5 times
Example:-abcbc,abcbcbc,abcbcbcbc

OR operator? ?| or []

(13)a(b|c)- Its matches string that has followed by b or c
Example:- ab,ac

(14)a[bc]- Its matches string that has followed by b or c
Example:- ab,ac

Character CLASSES? ? d w s and .

(15) d- Its matches a single character that is a digit
Example:- one1data,keepit1data,key2234

(16) w- Its matches alphanumeric character plus underscore
Example:-crack_yourinterview

(17) s- Its matches whitespace character(includes tabs and line breaks)
Example:- , ,

(18). - Its matches any character
Example:- a,cd,csd,fdf

d, w and s also present their negations with D, W and S respectively

3.

Write down regex which will find img tags is unclosed or not with REGEX?

Answer»

Write down regex which will FIND img tags is UNCLOSED or not with REGEX?
Below is the CODE to find that img tags is unclosed or not.


Regex Img