regex « Development « Spring Q&A

1. Parse request URL in JSTL

I want to display a specific message based on the URL request on a JSP. the request URL can be:

On my I've got: car {0} event
events.action.people=My person {1} event
Finally, on ...

2. How to set a regex string with spring without it being escaped?

I'm using spring for setting my regular expression spring:

<property name="regularExpressionAsString" value="(?&lt;!\\.TMP)\\Z" />
public void setRegularExpressionAsString(String regularEx) {
    this.regularExpression = Pattern.compile(regularEx);
This doesn't work properly and when I debug my setter I've ...

3. Can someone check this regex statement please?

I just need to verify that this regex statement will do what I want. Given the following json string

I need to ensure that the following regex
Will always return the word following the ...

4. Spring's AntPathMatcher matching behavior with linux paths

I came across this weird behavior from AntPathMatcher, which I isolated in the unit test below:

    public void testAntPathMacherPotentiallyBrokenForNix() throws IOException {

5. Check if url equals or is a sub-directory of?

I am looking for a best-practice way of doing the following in java (perhaps using apache commons, some spring utility, or maybe just plain java/regex): I need to check if a given ...

6. Regex Validation only works with one single Character

I want to check if a userInput is free from special characters, here is my code:

public class ValidateHelper {

public boolean userInputContainsNoSpecialCharacters(String input){

        Pattern p ...

7. Apache Camel Regex Operator not matching

I'm trying to use Apache Camel (with Spring XML) to check if a message body matches a regex:

    <simple>${body} regex 'https?://(?:www\.)?twitter\.com[^\w]+'</simple>
    <to uri="activemq:queue:test"/>
So in ...

8. JSP, Spring framework - regular expression form validation

Is there a regular expression that can match 2 fields like: If I had a password and confirm password field, Is there a regexp that can match the 2 fields before the ...

9. Data Validation - Regular expression

I am working on a registration form, where i am providing validation(spring) for input (user)data. I have fields like Name (Full Name) Only Characters are allowed -> Acceptable values are : A, AB, A ...

10. Angle bracket in XML regex not matching

I have a regex stored within an Apache Camel XML file:

<simple>${body} regex '\s*&lt;+.*'</simple>
I am trying to match the string:
(the first part of an encoded XML file) i.e. literally the characters &lt;. The Problem ...

11. regex pattern in xsd

Hello Has anybody run into a problem validating a soap payload using regex patterns in the wsdl with a spring dispatcher? I am running an app with metro artifacts. jax-ws 2.1 ...

12. java regexp

13. FilterChainProxy and use of RegExp matcher

FilterChainProxy and use of RegExp matcher I posted this message on the mail list, and received no response - so I am posting it here as well. Currently, the regexp matching ...

14. handlerMapping and Pattern Matching (Regex)

Hello I have two Urls that need to go to two different Controllers The first one is "/mypath/myFirst" myFirstController The second one will match any letter mySecondController If ...

15. Validating a Float with regexp?

Validating a Float with regexp? Hello I'm trying to validate a Float private final Constraint DRAUGHT_CONSTRAINT = all(new Constraint[] { new regexp( "/^\\d{0,2}(\\.\\d{0,2})?$/"), "xxx" }); ... add("draught", DRAUGHT_CONSTRAINT); But regexp.test is ...

16. RegExp Problem with {} in 1.1.0.M1

Currently, I got trouble defining a regExp with curly brackets in 1.1.0.M1. Example pattern (taken from ROO-639: @Pattern(regexp="\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[a-zAZ]{2,4}\\b") which causes this error: Code: java.lang.IllegalArgumentException: unknown format type at at java.text.MessageFormat.makeFormat( at ...

17. Support of regex in header-value-router

Support of regex in header-value-router Hi, Do you think it might be possible to add regex support on the tag ? Like instead of : Code: ...