#problem with regex
1 messages · Page 1 of 1 (latest)
Detected code, here are some useful tools:
import java.util.Arrays;
public class testing {
public static void main(String[] args) {
System.out.println("[email protected]".matches("\"\\w+@\\w+.(com|us|uk)\"i"));
}
}
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
Your regex includes quotes and an i at the end.
so I can't add regex flags in java?
case insensitive
oh well mby, I was just copying the regex from https://regex101.com/ and whenever I paste it without any quotes it's error so I put the whole thing in quotes
u can. but it works differently
Pattern.compile("blabla", flags here)
consult the doc for details
cause that website is purely about regex and not how to write regex in languages
oh I see, thanks!
No u can select among different regex dialects, including the java one, just that it defaults to the php version
So sometimes it causes confusion
that doesnt give u the correct strings with escapes and syntax though
its merely the underlying regex engine that changes
since they all work slightly different and have different feature sets
Oh that yeah
But if you copy a regex and paste it inside the string quotes, intellij automatically escapes it
yeah. bc intellij is intellij
but it wouldnt have helped here with the flags
since the flag syntax in java is different