December 2023
Intermediate to advanced
242 pages
5h 28m
English
| Recipe 52 | Matching Non-ASCII Words with the Unicode Property Escape |
Let’s assume you want to search for a file with a specific extension and extract the filename. This task is similar to Recipe 31, Extracting a Matched Value with the Capturing Group, where you matched a file with a .pdf extension.
Now you want to match a filename that has non-ASCII characters. It’s not uncommon for people to save files in their own language, but your current script is unable to match non-ASCII letters:
| | const re = /\b(\w+)\.pdf\b/; |

You need a solution that allows you to match non-ASCII words. ...
Read now
Unlock full access