Solved

Java matches regular expression

Posted on 2013-11-24
2
282 Views
Last Modified: 2013-11-24
Hi,
I have this regular expression which i would be using with matches..

String reg = "(?:\\s|\\A)[##]+([A-Za-z0-9-_]+)";

What does this mean? there is ? and etc...To me, it looks, like the string must start with s or A followed by the hash sign and then, it should words ...Is this right ?
0
Comment
Question by:zizi21
2 Comments
 
LVL 18

Accepted Solution

by:
Matthew Kelly earned 500 total points
ID: 39672919
Here is a list of all the regular expression codes that you can use as future reference: http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/

The expression would find a string that started with either "\A##" or "\s##" and then was followed by a string of letters, numbers or a dash or underscore.

So for example "\s##TestingRegEx" would match.

You can test it here, highlighted over each part even outlines what each one means:

http://gskinner.com/RegExr/
0
 

Author Closing Comment

by:zizi21
ID: 39673067
Thanks a lot.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
network + 7 80
topping2 challenge 13 80
Groovy:unable to resolve class error 2 68
Basic Java Case or If-Else statement... 3 43
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now