Regex to match only uppercase “words” with some exceptions

前端 未结 6 2041
面向向阳花
面向向阳花 2020-12-02 20:26

I have technical strings as the following:

\"The thing P1 must connect to the J236 thing in the Foo position.\"

I would like to match with

6条回答
  •  执念已碎
    2020-12-02 21:08

    I'm not a regex guru by any means. But try:

    <[A-Z0-9][A-Z0-9]+>
    
    <           start of word
    [A-Z0-9]    one character
    [A-Z0-9]+   and one or more of them
    >           end of word
    

    I won't try for the bonus points of the whole upper case sentence. hehe

提交回复
热议问题