?
Solved

Java matches regular expression

Posted on 2013-11-24
2
Medium Priority
?
302 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
[X]
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 Comments
 
LVL 18

Accepted Solution

by:
Matthew Kelly earned 2000 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

Industry Leaders: 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!

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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.
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 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 …
Suggested Courses
Course of the Month11 days, 19 hours left to enroll

752 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