Home > Software design >  Regex to match one occurrence of a character without the duplicates
Regex to match one occurrence of a character without the duplicates

Time:06-07

I have a file that has lines starting with triple ticks "```" and single tick "`".

I want to match only the single tick ones. So the expression would show me "`single" and not "```triple"

```triple
`single

CodePudding user response:

You could use the following regex pattern:

^`(?!`).*$

This would match only lines starting with a single backpack. Here is a working demo.

  • Related