" Live as if you were to die tomorrow. Learn as if you were to live forever.. "
- Mahatma Gandhi

Regular expression to filter out US phone numbers

Posted on November 23rd, 2015 by Bibhudutta Pradhan

My recent work on IE8+ plugin development needed me to filter out any US phone numbers present in a webpage. Filtering process could be done in many ways, now the problem is, although there is a particular phone number format for writting down the phone numbers but its very less followed. So in order to […]

Testing Regular Expression in QTP

Posted on November 23rd, 2015 by Jyoti Kar

QTP through Vb script engine provides the RegExp class which is used for general regular expression evaluation and processing. ‘Function to check if a string matches a regular expression pattern’. Function RegEqual(r_Text,r_Pattern,MatchCompleteString) Dim regEx,retVal ‘Create regular expression object’. Set regEx=New RegExp ‘Set pattern’ regEx.Pattern=r_Pattern ‘Ignore case’ regEx.IgnoreCase=True ‘Match complete String or Not’ regEx.Global=MatchCompleteString ‘Test the […]

Ways to parse an HTML document text

Posted on November 23rd, 2015 by Tapaswini Mohanty

This tip shows how we can parse an HTML document using HTMLDocumentClass and Regular Expression Problem: We need to parse a html document and get only the style element from the whole html document text. Lets say our html document is as below: <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml” > <head> <title>My […]