Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Regular Expression for my output"
12-08-2011, 05:53 PM
Post: #1
"Regular Expression for my output"

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
Find all posts by this user
Quote this message in a reply
12-08-2011, 08:34 PM
Post: #2
RE: "Regular Expression for my output"
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.*
Find all posts by this user
Quote this message in a reply
12-13-2011, 09:39 AM
Post: #3
RE: "Regular Expression for my output"
(12-08-2011 08:34 PM)ravi.gajul Wrote:  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.*

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.
Find all posts by this user
Quote this message in a reply
12-13-2011, 03:29 PM
Post: #4
RE: "Regular Expression for my output"
Well then .....Test.*...... should have helped.
Find all posts by this user
Quote this message in a reply
12-13-2011, 04:35 PM
Post: #5
RE: "Regular Expression for my output"
Hi Sures,

Can you try this..


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

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
Find all posts by this user
Quote this message in a reply
12-16-2011, 09:13 AM
Post: #6
RE: "Regular Expression for my output"
(12-13-2011 04:35 PM)Ankesh Wrote:  Hi Sures,

Can you try this..


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

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

It's working good, Thanks Ankesh.
Find all posts by this user
Quote this message in a reply
12-16-2011, 04:22 PM
Post: #7
RE: "Regular Expression for my output"
Glad that it worked. Big Grin
Find all posts by this user
Quote this message in a reply
12-27-2011, 04:19 PM
Post: #8
RE: "Regular Expression for my output"
(12-08-2011 05:53 PM)suresz449 Wrote:  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.

test_\[1-9][0-9].*up_\[a-z][a-z]_unit


Thanks and Regards,
Suresh D
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Regular expression for this string falvi 2 238 04-30-2012 11:14 AM
Last Post: falvi
  regular expression rjkmr.aiht 0 146 04-27-2012 11:37 AM
Last Post: rjkmr.aiht
  Regular Expression samverma 3 348 03-31-2012 01:21 AM
Last Post: samverma
  Square Bracket Issue - Regular Expression kapsig431 2 281 03-29-2012 08:38 PM
Last Post: kapsig431
  Regular Expression for time in 24 hour format with out colon Pallavi 3 431 03-13-2012 11:29 AM
Last Post: sshukla12

Forum Jump:


User(s) browsing this thread: 1 Guest(s)