-4

I want to extract first 3 letters of the sentence which start with M and are followed by 2 digits.

If sentence is M30 INTHE SKY then output should be M30. IF sentence is THE INTHE SKY then answer should be np.nan(i.e. false as it didnot start with M)

soumya sharma
  • 73
  • 1
  • 1
  • 5

1 Answers1

0

M\d{2}

  • M for literal M
  • \d to match one digit
  • {x} to match the previous token x times

If you do a search it will return the matched result; gives empty otherwise.

palvarez
  • 1,508
  • 2
  • 8
  • 18