I'm not sure about the meaning of this regular expression.


Does that mean, we don't want any string started with the letter a or contain a. And we don't want any string ended with also the letter a ?.


1 Answer 1

  • ^ asserts position at start of a line
  • [^a] Match a single character not present in the list
  • * Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
  • $ asserts position at the end of a line

So it will essentially match any line and does not contain an a

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.