Last active
March 17, 2021 19:30
-
-
Save IvanGavrikov/e74267cbcc2285a971b6468a73bcbde5 to your computer and use it in GitHub Desktop.
Регулярки
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Выделения окончания ссылки. | |
| Регулярка: /(?!\/)([^\/]+)$/ | |
| Пример: https://acuvue.testpromo.site/preview/8f34f792-6e9f-4334-8b28-e850da3f7cd2 | |
| Результат: 8f34f792-6e9f-4334-8b28-e850da3f7cd2 | |
| 2. Извлечение имени файла | |
| Регулярка: /(?<filename>^.*)(?<extension>\.[^\.]+)$/ | |
| Пример: "Screenshot from 2021-03-14. 09-00-01.png" | |
| Результат: | |
| filename: "Screenshot from 2021-03-14. 09-00-01" | |
| extension: ".png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment