Hello! Dear community, as always, I ask for your help. Help create a universal template.

There is a list of lines:

  1. ap JSC "TGC-2"
  2. JSC "TGC-2"
  3. TGK-2 an
  4. TGK-2 ao
  5. TGK-2 an
  6. TGK-2 ao
  7. Sberbank of Russia JSC ao
  8. Sberbank of Russia JSC
  9. "KrasnyOktyabr" JSC - JSC
  10. OJSC "KrasnyOktyabr" - JSC

Variations of the name itself can be many, I specifically need something like this plan:

(ао|ап)(здесь название)(ао|ап) 

such a template is needed to further saw off ao or an, depending on where this phrase will be located, the task is to get only the name itself without ao or an and without the “-” symbol

I came up with such a template, but it doesn’t really want to work:


    2 answers 2

    Try this pattern:


    • Thank! It turned out a little dopil: ^ (ao | an)? (\ S- \ s)? (. *?) (\ S -)?


    • Yes, you can, and thank you for your participation! - Artyomich