0
votes
2answers
175 views

Can regexp be used to check for palindromes?

Can regexp pattern matching be used to check for palindromes within a given text in Java? My intuition is that in order to check for palindromes, we may need to remember the character that was ...
1
vote
4answers
596 views

Regex to String generation

Let's say that we have a regex and an index i. If we suppose that the set of strings that match our regex are sorted in a lexicographical order, how could we get the i element of this list? Edit : I ...
3
votes
1answer
213 views

Object oriented parser model review

First time I make use of Code Review. At the moment I'm creating an Android application and the company I'm developing it for, has a specific file format that can be used to give text based data ...
3
votes
1answer
926 views

Java regex patterns - compile time constants or instance members?

Currently, I have a couple of singleton objects where I'm doing matching on regular expressions, and my Patterns are defined like so: class Foobar { private final Pattern firstPattern = ...
2
votes
1answer
297 views

Optimized Special Character Escaper vs Matcher/Pattern

I need to escape special characters which are sent to apache lucent. Since the code will run on a production server I want the code to be the fastest possible. I've seen multiple ways to do it: ...
4
votes
2answers
298 views

Why does Java define homogeneous methods in Matcher and Pattern classes

I wonder why java defines homogeneous methods in two distinct classes: java.util.regex.Pattern and java.util.regex.Matcher. For example split method defined in Pattern class and replaceAll method ...