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
Solved

Java matches regular expression

Posted on 2013-11-24
2
289 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 50
windows explorer path to command prompt 5 54
ejb wildfly example 2 16
hashmap order 17 36
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

789 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