I need a regex pattern to return strings that contains ‘bg-hh-‘ and not containing ‘/’.
Input:
.md\:hover\:bg-hh-graBla\/25:hover
.md\:hover\:bg-hh-graBla\/30:hover
.md\:hover\:bg-hh-graBla\/35:hover
.md\:hover\:bg-hh-graBla:hover
Output:
.md\:hover\:bg-hh-graBla:hover
>Solution :
You can use:
^[^\/\r\n]*bg-hh-[^\/\r\n]*$
Note:
You can add more restrictions, if necessary:
^[^\/\r\n]*:bg-hh-[^\/\r\n]*$: You can add a:, beforebg-hh-.^\.md\\:hover\\:[^\/\r\n]*bg-hh-[^\/\r\n]*$: This includes.md\:hover\:beforebg-hh-.
[^\/\r\n]means all chars except those in the[].*means zero or more times.