We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Matching Anything But a Newline
Matching Anything But a Newline
Sort by
recency
|
403 Discussions
|
Please Login in order to post a comment
The regex pattern you're looking for is ^...$ — this matches exactly three characters, each of which can be any character except a newline. Golden 365
regex_pattern = r'^.{3}..{3}..{3}..{3}$'
we need to use ^ at the start and $ at the end as we search for exact match in the entire test_string
test_string must be in the required format and there is only one occurence of the required string we are searching for.
I hope I explain it well
either of these would do
My regex:
^((?:[^\n]{3}.){3}(?:(?:[^\n]){3}))$