Announcement Announcement Module
Collapse
No announcement yet.
Using backslash '\' in a bean value Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using backslash '\' in a bean value

    Hi all,

    I use spring for a configuration of a Regexp. When I use the following configuration my backslash are doubled:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

    <beans>
    <bean class="com.titi.RegexpMatcher">
    <property name="patternToMatch">
    <value><![CDATA[((\d{1,2}\.\d{1,3}\.\d{1,3}\.\d{1,3}))"]]></value>
    </property>
    </bean>
    </bean>

    Does anyone know how to keep only single backslash?

    Thanks in Advance,
    Geatan,

  • #2
    AFAIK, backslash inside XML files is a reserved word and should be declared differently (similar to how & is declared as &amp. I don't have an XML reference at hand but you should be able to find these 'special' characters rather quickly.

    Comment


    • #3
      What exactly do you mean by "doubled"? If you look at the String after injection, it should be normal that the backslashes are doubled (due to java string escaping).

      Does the injected regexp work?

      Regards,
      Andreas

      Comment

      Working...
      X