Regex 用循环替换程序批量生成的txt文件中的字

Regex 用循环替换程序批量生成的txt文件中的字,regex,autohotkey,Regex,Autohotkey,基本上扑克客户端程序生成文件(txt)作为手历史记录,我想有一些程序自动编辑手历史记录,只需在数字前面添加“$”符号,然后在新目录中生成新的txt文件,这样我就可以在另一个软件中分析新创建的文件 下面是一个手动历史记录示例: Full Tilt Poker Game #23461961057: Table .COM Play 463 (deep) - 3000/6000 - No Limit Hold'em - 15:16:29 ET - 2010/08/29 Seat 2: Player1

基本上扑克客户端程序生成文件(txt)作为手历史记录,我想有一些程序自动编辑手历史记录,只需在数字前面添加“$”符号,然后在新目录中生成新的txt文件,这样我就可以在另一个软件中分析新创建的文件

下面是一个手动历史记录示例:

Full Tilt Poker Game #23461961057: Table .COM Play 463 (deep) - 3000/6000 - No Limit Hold'em - 15:16:29 ET - 2010/08/29  
Seat 2: Player1 (795,425)  
Seat 5: Player2 (1,200,000)  
Player1 posts the small blind of 3,000  
Player2 posts the big blind of 6,000  
The button is in seat #2  
**** HOLE CARDS ****
Dealt to Player1 [Ac 4c]  
Player1 raises to 12,000  
Player2 raises to 687,000  
Player1 raises to 795,425, and is all in  
Player2 folds  
Player2 adds 687,000  
Uncalled bet of 108,425 returned to Player1  
Player1 mucks  
Player1 wins the pot (1,374,000)  
*** SUMMARY ***  
Total pot 1,374,000 | Rake 0  
Seat 2: Player1 (small blind) collected (1,374,000), mucked  
Seat 5: Player2 (big blind) folded before the Flop  
下面是我想要的已处理文件:

Full Tilt Poker Game #23461961057: Table .COM 463 (deep) - $3000/$6000 - No Limit Hold'em - 15:16:29 ET - 2010/08/29
Seat 2: Player1 ($795,425)
Seat 5: Player2 ($1,200,000)
Player1 posts the small blind of $3,000
Player2 posts the big blind of $6,000
The button is in seat #2
*** HOLE CARDS ***
Dealt to Player1 [Ac 4c]
Player1 raises to $12,000
Player2 raises to $687,000
Player1 raises to $795,425, and is all in
Player2 folds
Player2 adds $687,000
Uncalled bet of $108,425 returned to Player1
Player1 mucks
Player1 wins the pot ($1,374,000)
*** SUMMARY ***
Total pot $1,374,000 | Rake $0
Seat 2: Player1 (small blind) collected ($1,374,000), mucked
Seat 5: Player2 (big blind) folded before the Flop
我做了一些研究,并提出了自动热键作为这样做的结果,但我是一个新手,当涉及到编程,正则表达式是强奸我的大脑,因为我键入这个。任何帮助都很好。

(?
(?<!Seat )(?<![a-zA-Z#])([0-9]+(?:,[0-9]+)*)
替换为$\1

基本上,这会查找所有可以用逗号分隔的数字,逗号不以“#”或字母或座位开头(因为我注意到在字符串“全速扑克游戏#23461961057”和“座位2”中,您没有添加$).算法是贪婪的,因此应考虑到模式在每个逗号后重复,以逗号除以数字


如果您使用的是javascript,很遗憾您不能使用“向后看”。

让我想起了一个电脑怪人的老笑话……“嘿,雷吉,向后看。”“那是什么?”“嗯,当然不是javascript,哈哈哈!”(管理层想为最后一个笑话道歉,并向您保证,作者将继续服用药物以防止进一步爆发。)啊,好吧,让代码看起来没有现有语言不是很难吗~_^