0% found this document useful (0 votes)
48 views7 pages

It Matches With Occurrence of Char Ex: Ca.r Car (Wrong) Caar Cabr

Regular expressions are strings that contain wildcard characters to enable checking for text strings with varying values or identifying objects with changeable properties. Common wildcard characters include ., *, ?, +, [], (), which can match different occurrences of characters. Regular expressions are useful for validating input fields like validating only alphabets, only alphanumeric values, or values within a certain range.

Uploaded by

harikaparimala06
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views7 pages

It Matches With Occurrence of Char Ex: Ca.r Car (Wrong) Caar Cabr

Regular expressions are strings that contain wildcard characters to enable checking for text strings with varying values or identifying objects with changeable properties. Common wildcard characters include ., *, ?, +, [], (), which can match different occurrences of characters. Regular expressions are useful for validating input fields like validating only alphabets, only alphanumeric values, or values within a certain range.

Uploaded by

harikaparimala06
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

Regular Expressions

A Regular Expression is a String that Contains Wild Character which Enables QTP Check For a text String with Varying ( Changeable ) Values or Identify the Objects with Changeable Properties .

Whiled Characters Used with Regular Expression :

. it Matches with 1 occurrence of any Char Ex : ca.r car ( Wrong ) caar cabr --------------------------------------------* it Matches with 0 or More occurrence of preceding Char Ex :

Ca*r cr car caar caaar --------------------------------------------.* it Matches with 0 or More occurrence of Any Char Ex : Logout .* Logout A Logout B Logout AB Logout ABC --------------------------------------------? it Matches with 0 or One occurrence of preceding Char

Ex : Ca?r cr car caar ( Wrong ) caaar ( Wrong ) --------------------------------------------+ it Matches with 1 or More occurrence of preceding Char Ex : Ca+r Cr ( Wrong ) car caar caaar

--------------------------------------------[ABC] it Matches with Any one Chr Specified in The List Ex : QTP[ABC] QTPA QTPB QTPC 200[789] 2007 2008 2009

--------------------------------------------[^ABC] it Matches with Any one Chr Except in The Specified List Ex : QTP[^ABC] QTPA ( Wrong )

( Wrong ) ( Wrong ) QTPD ( Correct ) QTP ( Correct ) --------------------------------------------[A-Z] it Matches with Any one Upper Case Alphabet Ex : QTP[A-Z] QTPA QTPB QTPC QTPZ --------------------------------------------[a-z] it Matches with Any one Lower Case Alphabet Ex :

QTPB QTPC

QTP[a-z] QTPa QTPb QTPc QTPz --------------------------------------------[0-9] it Matches with Any one Numeric Ex : QTP[0-9] QTP0 QTP1 QTP2 QTP9 --------------------------------------------Note :

Regular Expression to Validate Alphabets Only


1)

[A-Z a-z]* [A-Z a-z]+


2)

it Allows Null Values Along with Alphabets

it Allows Only Alphabets

Regular Expression to Validate Alphanumeric Only

[A-Z a-z 0-9]*


Alphanumeric

it Allows Null Values Along with

[A-Z a-z 0-9]+

it Allows Only Alphanumeric

You might also like