帮助格式化正则表达式的文本 [英] help with formatting a text with regex

查看:96
本文介绍了帮助格式化正则表达式的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我的文字格式如下:

1- John(go-go-go-gone)to学校每天都在学校。

我需要这样才能看到这样的多种选择:

1。约翰......每天上学。

a。去了

b。去吧b $ b c。去

d。走了




你可以帮我吗?

解决方案

如果有的话总是这种格式的四个选项...



模式: ^([^(] +)\(([^ - ] + ) - ([^ - ] +) - ([^ - ] +) - ([^)] +)\)(*)



替换:


1 ____


Hello,
I have a text which is formatted like this:
1- John (went-goes-go-gone) to school every day.
I need this to have the look of mutiple choice like this:
1. John ...... to school everyday.
a. went
b. goes
c. go
d. gone


can you help me with that, please?

解决方案

If there are always four options in that format...

Pattern: ^([^(]+)\(([^-]+)-([^-]+)-([^-]+)-([^)]+)\)(.*)



Replace:


1 ____


这篇关于帮助格式化正则表达式的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆