The expression \w will match any word character.
Word characters include alphanumeric characters (-, - and -) and underscores (_).
Word characters include alphanumeric characters (-, - and -) and underscores (_).
\W matches any non-word character.
Non-word characters include characters other than alphanumeric characters (-, - and -) and underscore (_).
Non-word characters include characters other than alphanumeric characters (-, - and -) and underscore (_).
Task
You have a test string . Your task is to match the pattern
Here denotes any word character and denotes any non-word character.
Here denotes any word character and denotes any non-word character.
Note
This is a regex only challenge. You are not required to write any code.
You only have to fill the regex pattern in the blank (
You only have to fill the regex pattern in the blank (
_________
).
----------------------------------------------------------------------------------------------
Matching Word & Non Word Character - Hacker Rank Solutions
The regex pattern used is:
Regex_Pattern = '\w\w\w\W\w\w\w\w\w\w\w\w\w\w\W\w\w\w'
No comments:
Post a Comment