Skip to Main Content

General Development Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

In a Regular expressions I can set up an "OR" statement?

643633Oct 2 2009 — edited Oct 21 2009
HI, I'm using e-tester version 8.2..My problem is about regular expessions.

I need to catch a dynamic value from a Form Field (My-TxtBox).. this textbox gets pre populated data ( when the customer has info in the database).. this is the code:
----
*<input name="My-TxtBox" type="text" value="XXXX" id="ID-TxtBox"*
---- ( XXXX = dynamic number prepopulated by the web app)

So, I'm using this regular expression:
----
*<input name="My-TxtBox" type="text" value="(.+?)" id="ID-TxtBox"*
-----At this point, everything is fine.. but there is an exception

I'm getting a big problem when the customer doesn't have data in the server, the code is NOT like this
--
<input name="My-TxtBox" type="text" value="" id="ID-TxtBox"

When the customer doesn't have data in the server, the code is more like this:
----
*<input name="My-TxtBox" type="text" id="ID-TxtBox"*
---- (please note that there is not a value parameter now)

So, I think there is no way to create a CDV that will work for both cases? any idea to solve this?


---------------------------------------------------------------------------------------------------------------------------------------------------
i was thinking that maybe in the reg exps sintax you can create an "OR" statement.. my idea was to create a CDV
that works for both cases.. when there is the "value=" string and when there is not.

something like this

----
This CDV returns the dynamic value when there is the "value=" string =
<input name="My-TxtBox" type="text" value="(.+?)" id="ID-TxtBox"

And this CDV returns "" when there is no "value=" string = Without value:
<input name="My-TxtBox" type="text" (.*?)id="ID-TxtBox"

My idea is to place something like this in some point of the CDV = *{* value="(.+?)" *OR* (.*?) *}*

so my dream is to create a CDV similar to this:
-----
<input name="My-TxtBox" type="text" { value="(.+?)" *OR* (.*?) }id="ID-TxtBox
---

I was searching on google but I simply don't get an answer....it is posible to place an OR statement into a Reg Exp and how the sintax is? ..

Regards.. I appreciate your time.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 18 2009
Added on Oct 2 2009
2 comments
1,227 views