Hi,
I made a lab to test this scenario. I tried the following:

On R1:
#
sysname R1
#
bgp 300
router-id 1.1.1.1
peer 10.1.2.2 as-number 500
peer 10.1.2.2 description R2
peer 10.1.2.2 password simple 1122
#
ipv4-family unicast
undo synchronization
import-route direct
peer 10.1.2.2 enable
peer 10.1.2.2 route-policy AS500-IN import
#
route-policy AS500-IN permit node 10
if-match as-path-filter AS500-IN
#
ip as-path-filter AS500-IN permit ^(500_)+((700_)*|(900_)*)$
--------------------------------------------------------------------------------
Another format I tried (multiples regex):
#
ip as-path-filter AS500-IN permit ^(500_)+$
ip as-path-filter AS500-IN permit ^(500_)+(700_)+$
ip as-path-filter AS500-IN permit ^(500_)+(900_)+$
#
All of them were accepted in both formats:
500
500 700
500 900
--------------------------------------------------------------------------------
Then, I made a new test, to block AS900, and intentionally changed AS900 to AS800 on as-path-filter:
#
ip as-path-filter AS500-IN permit ^(500_)+((700_)*|(800_)*)$
#
After that, success! only AS500 and AS700 (even with prepends) were accepted by filter and AS900 was dropped:
Total Number of Routes: 13
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 0.0.0.0 0 0 ?
*> 1.11.11.11/32 0.0.0.0 0 0 ?
*> 2.2.2.2/32 10.1.2.2 0 0 500 500 500 500?
*> 2.22.22.22/32 10.1.2.2 0 0 500 500 500 500?
*> 3.3.3.3/32 10.1.2.2 0 500 500 500 500 700 700 700 700 700?
*> 3.33.33.33/32 10.1.2.2 0 500 500 500 500 700 700 700 700 700?
*> 10.1.2.0/30 0.0.0.0 0 0 ?
10.1.2.2 0 0 500 500 500 500?
*> 10.1.2.1/32 0.0.0.0 0 0 ?
*> 10.2.3.0/30 10.1.2.2 0 0 500 500 500 500?
*> 10.2.4.0/30 10.1.2.2 0 0 500 500 500 500?
*> 127.0.0.0 0.0.0.0 0 0 ?
*> 127.0.0.1/32 0.0.0.0 0 0 ?