Match Word Characters

Use \w to match word characters.

Preview

Code

<script>
let text = "User_123";

let result = text.match(/\w+/);

console.log(result);
</script>

More JS RegExp Examples (7)