#9741

JohnQSmith
Participant

I played with it a while and finally figured it out. Here’s an example.

Input document

TheGreenAile TheGreenBile TheGreenCile TheGreenDile
TheGreenEile TheGreenFile TheGreenGile TheGreenHile
TheGreenIile TheGreenJile TheGreenKile TheGreenLile
TheGreenNile TheGreenOile TheGreenPile TheGreenQile
TheGreenRile TheGreenSile TheGreenUile TheGreenVile
TheGreenWile TheGreenXile TheGreenYile TheGreenZile

Search string

(?:([BFNPR])|([^BFNPR]))(ile)

Replace string

(?1:M:T)3

Replace all and output is

TheGreenTile TheGreenMile TheGreenTile TheGreenTile
TheGreenTile TheGreenMile TheGreenTile TheGreenTile
TheGreenTile TheGreenTile TheGreenTile TheGreenTile
TheGreenMile TheGreenTile TheGreenMile TheGreenTile
TheGreenMile TheGreenTile TheGreenTile TheGreenTile
TheGreenTile TheGreenTile TheGreenTile TheGreenTile

I color coded it to help you see what’s happening.

Oh yeah, the Boost regex docs helped me figure it out.