1
I get lost doing any complex regex.
I use the following code in java:
Pattern pattern = Pattern.compile("tentativas de regex aki");
Matcher matcher = pattern.matcher(conteudo);
while(matcher.find()) {
System.out.println(matcher.group());
}
And for the regex , it must do the following search:
[Any character Special] [free spaces (any quantity) containing a maximum of 1 line] [letters] ['not letter' (the first q appears ends)]
Caption:
- line - n
- space - ' '
free space - I only thought this way because I would like him to finish the regex only after seeing the first letter, but not if they came two lines or more!
Can someone convert it to regex?
any amount of space or line?
– user28595
Rodrigo, I also did not understand what this "space or line" would be. I also didn’t understand if it can be "in any amount" or if it should only have one line as the title says. Could clarify these doubts and put some examples of valid and invalid values?
– utluiz
edited I hope it helps to understand. It is difficult to even explain ...
– Rodrigo Santiago
Put test cases that should be accepted and should be rejected.
– Pablo Almeida
From what I understand it is enough to test if there is a break. Isn’t that so? For a single line there is no break.
– Ivan Ferrer
It would be something like this (anything that doesn’t have a break) :
/(.*)[^\n]+/
. Example, if you go all the way do this.– Ivan Ferrer