Solved

Java matches regular expression

Posted on 2013-11-24
2
281 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
Comment Utility
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
Comment Utility
Thanks a lot.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Unable to open debugger port in Intellij idea 6 78
strCount chalenge 3 50
strDist challenge 35 84
recursion example 16 66
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

771 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

10 Experts available now in Live!

Get 1:1 Help Now