IF/Else logic in Regular Expression

Posted on 2009-05-05
Last Modified: 2012-06-21

I am facing situation where i need create the logic that is similar to a ternary operator.

I dont have the freedom to use any mainstream languages.

This is what i need to do

If something is blank do this other something else


Question by:justin_smith
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
LVL 92

Accepted Solution

objects earned 500 total points
ID: 24311134
LVL 84

Expert Comment

ID: 24311203
What non-mainstream  languages do you have the freedom to use?
what do you want to do if something is blank?  what do you want to do if not?
regular expressions themselves don't really do anything other than match or not match
sometimes other languages may use the matching result from the language described by the regular expression to do something like substitute the string that was matched.

Author Comment

ID: 24311231

i can only put regex into a third party interface.. this accept regex..

Ok this is what i want to do..

If variable CONFIG is blank variable MESSAGE should be assigned the text BLANK else FULL

This is not exactly what i want to do..

But logic is easily ported


Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 84

Expert Comment

ID: 24311255
Does this third party interface that accepts regular expressions have a means for specifying which variables to test and assign?
Does this interface return anything that you can them use to do an assignment yourself?

Author Comment

ID: 24311269
It is not so much developer friendly..

But i can see what is eventually assigned by getting an SMS..

If you could structure the Regex i might be able to tweak it according the way the thirdparty interface works.. hopefully


LVL 92

Expert Comment

ID: 24311464
another discussion here

what flavor of regexp do you need to use?


Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question