Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Need Regex expert - small fix

Last post 02-07-2010, 2:31 AM by Sergei Z. 1 replies.
Sort Posts: Previous Next
  •  02-06-2010, 5:27 PM 59351

    Need Regex expert - small fix

     Hello!

    I am trying to modify a javascript regex (written by a 3rd-party) to add support for xml namespaces, which is simply any 2 words separated by a colon, i.e., word1:word2

    Here is the orginal regex definition (does not recognize word1:word2)

    • tagTokenRe = /^(#)?([\w-\*]+)/

    Note: I believe the # (pound sign) is used as a template character that gets replaced by various strings at run time.  It is not a literal match to '#'

    Here's a regex that I wrote that works, BUT it breaks other use cases. 

    • tagTokenRe = /^(#)?([\w-\*]+:?[\w-\*]+)/

    I've tried other variations with no luck.  All of my changes break the application (the regex is in a common subroutine).

    So, I'm desparate for a new regex that will match word1:word2 without changing ANY other patterns matched by the original.  All help is truly appreciated.

  •  02-07-2010, 2:31 AM 59362 in reply to 59351

    Re: Need Regex expert - small fix

    u did not provide enough details.

    pls define *other use cases* + provide text you are matching against + what exactly needs to be matched in the text

View as RSS news feed in XML