If you took the grep regexp grammar, not the egrep one, or the sed regexp grammar and used that you should be using a safe subset across many platforms and tools.
About the only thing that may bite you then is when you go shift between regexp implementations using Finite State Automatons (FSA) and ones using backtracking, e.g. quantifier implementations will vary from grep to Perl.
FSA based implementations will find longest match starting at the first possible position. Backtracking ones will find the left-biased first match, starting at the first possible position. That is, it will try each branch in the order in the pattern until a match is found.
Consider the string "xyxyxyzz"
, and the pattern "(xy)*(xyz)?"
. FSA based engines will match the longest possible substring, "xyxyxyz"
. Back-tracking based engines will match the left-biased first substring, "xyxyxy"
.