Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Regular Expression for my output"
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Folks,

while I run my script I am getting output like as Test_9UP_ab_UNIT.
In my output the value 9 and ab are changing dynamically so, please can any one give me the regular expression for the above string.




Thanks and Regards,
Suresh D
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Assuming UP is always preceeded by a anumber between 0-9 and _Unit preceded by two characters
Test_[0-9]UP_[a-z][a-z]_UNIT

if this doesn't help
try
Test.*
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Ravi,

You are giving regular expression for 9 and ab but in my output sometimes the value may be 10,11,...... and ab,abc,abcd,azfdg,....... etc.these values are changing dynamically so, please provide the regular expression for given string.
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
Well then .....Test.*...... should have helped.
Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Sures,

Can you try this..


Code:
strText="Test_101UP_abcde_UNIT"

Set RegEx = CreateObject("VBScript.RegExp")
'The below is the patter which can be used in your case
'\d{1,} - means any digit which will occur atleast once and may appear n times
'[a-z]{2,} - any two digit character to n length characted
'$ - indicates the end of the string

Code:
RegEx.Pattern ="^Test_\d{1,}UP_[a-z]{2,}_UNIT$"

result=RegEx.Test(strText)
If result=True Then
    msgbox "Pass"
Else
    msgbox "Fail"
End If

Set RegEx=Nothing

let me know if it works.

Regards,
Ankesh
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
It's working good, Thanks Ankesh.
Reply
#7
Solved: 11 Years, 4 Months, 3 Weeks ago
Glad that it worked. Big Grin
Reply
#8
Solved: 11 Years, 4 Months, 3 Weeks ago
test_\[1-9][0-9].*up_\[a-z][a-z]_unit
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,519 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,390 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,854 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,630 12-08-2014, 06:38 PM
Last Post: anshika.agarwal
  need a regular expression. anu05446 0 3,139 11-26-2014, 03:00 PM
Last Post: anu05446

Forum Jump:


Users browsing this thread: 1 Guest(s)