Match both of these with regex, not just one of -
i'm looking in sql table through bunch of names , want list of different titles used. e.g. snr, mrs, mr, jnr etc
sometimes there entry might have 2 titles, e.g: mr name name jnr. want both of these titles 'mr' & 'jnr'
i thought way regex , find names have 2 or 3 characters. title @ front followed space, while title @ end preceded one. have:
/(^[a-z]{2,3})\s|\s(^[a-z]{2,3}$)/
as can see i've used 'match either or b' thing. if throw @ name title @ either start or finish, end getting want, don't know how tell both. i.e. strings 2 titles give me 1 match.
how both?
instead of "or", match character in between:
Comments
Post a Comment