Regex for Bash script to filter MIPS instruction -


i have been trying devise expression checks against mips instructions such on:

lw $t1 70000($s0) 

i have expressions lw , $t1 part, stuck on 70000($s0) part.

the number before ($s0) cannot exceed −32768 or 32767, $ has there once, s part has s or t , occur once , number afterwards can range 0-7 s , 0-9 t.

any on appreciated.

here expression have $s0 part section of script:

^(\$((s?[0-7])|(t?([0-9]))))$ 

i using in if statement check if inputted text valid, prefixed number part stuck on.

thanks

edit1: have managed separate value ($s0) using offset=${w3%(*} truncate string before first (. script wont deal such ( before value.

i need check whether value less −32768 or greater 32767. idea how can archive this?

edit2: have managed solve problem , posted solution answer, responded.

(-?[0-9]{1,5})\(\$(s[0-7]|t[0-9])\) agree it's wasted effort have regex detect numeric range. above captures offset , register described them, bit of correction , simplification.


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -