How do I fix this regex, to not touch the expansions like HYDRAULIC
and only convert HYD
and HYD.
to HYDRAULIC
and fix the space issue (for HYD.CYLINDER
)?
Regex (hyd.
and hyd
):
\b(hyd)(?:\s|$|[^\w])
Test String:
HYD. CYLINDER
HYD CYLINDER
HYD.CYLINDER
HYDRAULIC CYLINDER
CYLINDER,HYD.
CYLINDER,HYDRAULIC
CYLINDER,HYD
CYLINDER, HYD.
CYLINDER, HYDRAULIC
CYLINDER,HYD
Substition:
HYDRAULIC
HYDRAULIC CYLINDER
HYDRAULICCYLINDER
HYDRAULICCYLINDER
HYDRAULIC CYLINDER
CYLINDER,HYDRAULIC
CYLINDER,HYDRAULIC
CYLINDER,HYDRAULICCYLINDER, HYDRAULIC
CYLINDER, HYDRAULIC
CYLINDER,HYDRAULIC