Is there a safe way to determine that part of an regular expression that is static i.e. that matches only one string?
I have a regular expression for file paths and I want to extract that part at the beginning that doesn't require regular expression so that I can perform a direct search to speed up performance.
For example, I have /some/path/.*\.jpg
Now I want /some/path/
and .*\.jpg
separately.
EDIT
The pattern could have any valid form. Maybe it doesn't even have a static part at the beginning but for the most times it does.
Aucun commentaire:
Enregistrer un commentaire