my problem is that some apps have an option to share certain messages through messaging apps, for example I've seen plenty of games where if you reach a new high score you can share with it with your friends through an app like WhatsApp. However some of them like to add a nasty message at the bottom like "Download this app yourself at play.google.com/way/too/long/url/", and sometimes I have seen useless stuff like that making the message twice as long!
Now for the actual question, I'd like to know if I can filter that message automatically before it gets send. If I could intercept the message and read it line by line I could filter it by making a RegEx for it.
Some stuff to keep in mind: My device is rooted, and I plan on getting Xposed as soon as it becomes available for Nougat. I run CyanogenMod 14.1 based on Android 7.1.1 and I have barely any experience with making Android apps but I guess my general Java knowledge is average.