The complication is because the button is a single position, but for full ring tables "EP" and "MP" can be different positions depending on how many players are in the hand.
The zero (0) in cash_hand_summary.str_aggressors_p LIKE '80%' and cash_hand_summary.str_actors_p LIKE '0%' is the button's position.
For "2bet" rather than "open" we only actually need the first part:
cash_hand_summary.str_aggressors_p LIKE '80%'
The equivalent of this for EP (from the other expression you quoted) is:
((cash_hand_summary.cnt_players BETWEEN 4 and 6 and substring(cash_hand_summary.str_aggressors_p from 2 for 1)::int BETWEEN 3 and 5) OR (cash_hand_summary.cnt_players BETWEEN 7 and 8 and substring(cash_hand_summary.str_aggressors_p from 2 for 1)::int BETWEEN 4 and 7) OR (cash_hand_summary.cnt_players BETWEEN 9 and 10 and substring(cash_hand_summary.str_aggressors_p from 2 for 1)::int BETWEEN 5 and 7))
This is doing the same test of "str_aggressors_p" but for different position numbers based on the number of players in the hand.
So anywhere that you see:
cash_hand_summary.str_aggressors_p LIKE '80%'
..in a BTN expression you need to replace that with the longer expression above for EP.
There is a similar expression with different table sizes and position numbers for MP, which you can find in the MP columns.
When you're looking at "open" stats (I'd suggest you start with "2bet" stats as they're a little simpler, and as Kraada suggested the "open" stats won't give you very different data for EP and MP) you'll also need to do the same comparison for the actors string (cash_hand_summary.str_actors_p LIKE '0%' from the first expression you quoted) but using the different position numbers for different table sizes.
Check out
this post for more information on using the actors and aggressors strings.