Can some one decode what these regex do?

Posted on 2006-07-22
Last Modified: 2010-03-31
I am debugging a piece of code and have a following scenario

private String REGEXP_VARIABLE_EXPANSION = "\\$\\{([\\w\\.?]*)\\}";

// How we test for booleans
private String REGEXP_BOOLEAN_VALUE = "True|T|Yes|Y";

If someone can give me an example string that will be great.  I know reverse engineering is crazy but what to do?

I am not a regex person.  But I have to work with a code.

Thanx in advance


Question by:slickdeals
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
  • 4
  • 2
LVL 37

Accepted Solution

Harisha M G earned 168 total points
ID: 17161560

By de-escaping (?) it, the regex becomes:


So, it matches any string that has initially a $ sign, then { and a character, then any no of characters, again }

For ex,


would match, but

${ hello}, ${.hello} etc won't match.

And the second one matches only True, T, Yes or Y
LVL 26

Expert Comment

ID: 17162023
I think, it is

${Combination of alpha numeric chars with dots}
LVL 26

Assisted Solution

ksivananth earned 166 total points
ID: 17162034
for e.g.,

"${hello.123.fine} Some Text ${hello1233...} Some more here ${Not Matches.}"

it matches,

Technology Partners: 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 26

Expert Comment

ID: 17162043
I feel, the "?" in the regex is irrelevant
LVL 86

Assisted Solution

CEHJ earned 166 total points
ID: 17162434
>>I feel, the "?" in the regex is irrelevant

True. Of course the regex will also match the empty var:


The other one should probably be named


LVL 26

Expert Comment

ID: 17162457
>>Of course the regex will also match the empty var:

LVL 37

Expert Comment

by:Harisha M G
ID: 17162738
${.hello} matches.. I was thinking of something else..

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

707 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