所以我遇到了一些正则表达式问题,我有一个表达式分别匹配开头和结尾。当我尝试在同一个表达式中匹配开头和结尾时会出现问题,我不明白为什么会出现问题。我什至尝试过考虑开始和结束标签之间的内容,但仍然没有运气。
Works: /^([ ])?\[(\/?)gaiarch(=[^"]*)?]([ ])?/ig
Works: /([ ])?\[(\/?)gaiarch(=[^"]*)?]([ ])?$/ig
Doesn't work: /^([ ])?\[(\/?)gaiarch(=[^"]*)?]([ ])?$/ig
我试图让它匹配:
[gaiarch=slider]
[img url="http://i1251.photobucket.com/albums/hh543/Knight-Yoshi/trade_c.png" text="Trading Image" goto="http://www.gaiaonline.com/gaia/bank.php?mode=trade&uid=15388423"],[img url="http://i1251.photobucket.com/albums/hh543/Knight-Yoshi/friend_c.png" text="Friends Image" goto="http://www.gaiaonline.com/friends/add/15388423"][/gaiarch]
[gaiarch=slider][img url="http://i1251.photobucket.com/albums/hh543/Knight-Yoshi/gaiaonline/thread/post/dark-center_bottom_zps419960f4.gif" text="bottom bar"]
[img url="http://i1251.photobucket.com/albums/hh543/Knight-Yoshi/gaiaonline/thread/post/star-say_right_zpsdc3769f3.png" goto="http://www.gaiaonline.com/"][/gaiarch]