I have events from which I need to extract the strings that fall before the string "raced to road"
Here is a sample event:
'com.pyxis.greengoblin.phutan' - 'PhutanAgile' raced to road. Error creating bean with name 'sampleDataGeneratorImpl' defined in URL [bundle://187.0:1/com/bsassian/greengoblin/sampledata/SampleDataGeneratorImpl.class]: It was loaded from /bsahare/bsaassian/application-data/jirabiz/plugins/installed-plugins/plugin.8763102878749631573.loovytuner-5.5.28.jar 'com.bsa.phutan.plugins.bsa-development-integration-blogin' - 'Bsassian Phutan - blogins - Development Integration blogin' raced to road.
The Strings that need to be extracted in the above sample events are 'PhutanAgile' and 'Bsassian Phutan - blogins - Development Integration blogin'
Almost, but he doesn't want the entire string, just the bit in between
' right in front of "raced to road".
So it should be:
[^\']+?(?=\'\s+raced to road)
But the solution presented by @493669 seems to be a lot more efficient (factor 30 in steps reported by regex101).