-1

I have a data frame and I want to flag all the elements inside this which contains character or character plus integer value.

After a little bit of search, I could make this regex but its not giving the expected output:

([A-Za-z]+[0-9]|[0-9]+[A-Za-z])[A-Za-z0-9]*

Expected output

alpha -  True
Alpha1 - True
A35. 1ha-True
Alp1Ha - True
A pha6-  True
12345 -  False
0 -      False
-23442 - False
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
rajan.sngh
  • 453
  • 2
  • 5
  • 17

2 Answers2

0

Try this : demo

^(?=.*[a-zA-Z]).+$

enter image description here

Ashraful Islam
  • 12,470
  • 3
  • 32
  • 53
0

You may use

^[^A-Za-z]*[A-Za-z].*$

See the regex demo

Details

  • ^ - start of a string
  • [^A-Za-z]* - 0 or more chars other than ASCII letters
  • [A-Za-z] - an ASCII letter
  • .* - any 0+ chars other than line break chars as many as possible
  • $ - end of string.
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563