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.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Regex
  3. Introduction
  4. Matching Word & Non-Word Character

Matching Word & Non-Word Character

Problem
Submissions
Leaderboard
Discussions
Editorial
  1. Prepare
  2. Regex
  3. Introduction
  4. Matching Word & Non-Word Character
Exit Full Screen View
  • Problem
  • Submissions
  • Leaderboard
  • Discussions
  • Editorial

The expression \w will match any word character.
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 (_).

Task

You have a test string . Your task is to match the pattern
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 (_________).

  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature