For example, I have a string "agreementinquiry-web-2.0.3". My result should only have "agreementinquiry".
If you want to remove it at search time, then you can use sed to help
| rex mode=sed "s/agreementinquiry\S+/agreementinquiry/g"
It follows the format as Replace/<REGEX_TO_CAPTURE>/<REGEX_TO_REPLACE>/global
If you want to remove it at index time, you should use SEDCMD