> If you want $2 to only ever be the first letter at or after the target > location, you can just tweak the second half of the regex: > > /^(?=.{0,$r}([^_]))?(?:.{$r}.*?([^_]))?/
Save a stroke: /^(?=.{0,$r}([^_]))?(?:.{$r,}?([^_]))?/ Roy
> If you want $2 to only ever be the first letter at or after the target > location, you can just tweak the second half of the regex: > > /^(?=.{0,$r}([^_]))?(?:.{$r}.*?([^_]))?/
Save a stroke: /^(?=.{0,$r}([^_]))?(?:.{$r,}?([^_]))?/ Roy