• Post Reply Bookmark Topic Watch Topic
  • New Topic

curiosity regarding Regex patterns and matches?  RSS feed

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this pattern which matches exactly to input string but why not this pattern matches which this input string

why so ?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea what you're asking. Can you please provide an SSCCE that shows exactly what you're doing (but no code other than what's necessary to demonstrate this regex question), and explain exactly what about the results you don't understand?
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:I have no idea what you're asking. Can you please provide an SSCCE that shows exactly what you're doing (but no code other than what's necessary to demonstrate this regex question), and explain exactly what about the results you don't understand?

to cut it short all I wanted to know is that , what exactly will be matched by this pattern
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
naved momin wrote:
Jeff Verdegan wrote:I have no idea what you're asking. Can you please provide an SSCCE that shows exactly what you're doing (but no code other than what's necessary to demonstrate this regex question), and explain exactly what about the results you don't understand?

to cut it short all I wanted to know is that , what exactly will be matched by this pattern


Well, the regex is \10d, and I don't think \1 is valid in that context. I think \1 means "the same thing that was matched by the first grouping" and then the 0 is just a literal 0. So you have to have a prior grouping for the \1 back-reference to refer to.

If you have "(abc|xyz) BLAH \\1" then abc BLAH abc would match, and xyz BLAH xyz would match, but abc BLAH xyz would not.

I think that's it, but not 100% sure. Google for something like java regex back-reference example.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!