Regex, All before an underscore, and all between second underscore and the last period?

How do I get everything before the first underscore, and everything between the last underscore and the period in the file extension?

So far, I have everything before the first underscore, not sure what to do after that.

.+?(?=_)

EXAMPLES:

  • 111111_SMITH, JIM_END TLD 6-01-20 THR LEWISHS.pdf
  • 222222_JONES, MIKE_G URS TO 7.25 2-28-19 SA COOPSHS.pdf

DESIRED RESULTS:

  • 111111_END TLD 6-01-20 THR LEWISHS
  • 222222_MIKE_G URS TO 7.25 2-28-19 SA COOPSHS


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation