如何用正则表达式将字符串中的某个子串提取出来
FN;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:=E5=A5=95=E5=BD=AC =E9=83=91
N;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:=E9=83=91;=E5=A5=95=E5=BD=AC;;;
ORG;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:=E5=8D=8E=E5=8D=97=E5=86=9C=E4=
=B8=9A=E5=A4=A7=E5=AD=A6;=E5=BC=80=E5=8F=91=E9=83=A8
TEL;HOME:075486652495
TEL;WORK:02082224556
TEL;CELL:15800038835
TEL;FAX;WORK:010245566
ADR;WORK;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:;;=E5=B9=BF=E5=B7=9E=E5=
=B8=82=E5=A4=A9=E6=B2=B3=E5=8C=BA=E4=BA=94=E5=B1=B1=E8=B7=AF;=E5=B9=BF=E5=
=B7=9E=E5=B8=82;=E5=B9=BF=E4=B8=9C=E7=9C=81;515000;=E4=B8=AD=E5=9B=BD
ADR;HOME;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:;;=E6=BD=AE=E9=98=B3=E5=
=8C=BA=E9=87=91=E6=B5=A6=E8=A1=97=E9=81=93=E6=A2=85=E8=8A=B1=E4=B9=A1;=E6=
=B1=95=E5=A4=B4=E5=B8=82;=E5=B9=BF=E4=B8=9C=E7=9C=81;515100;=E4=B8=AD=E5=
=9B=BD
就是将上面的
ADR;WORK;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:;;=E5=B9=BF=E5=B7=9E=E5=
=B8=82=E5=A4=A9=E6=B2=B3=E5=8C=BA=E4=BA=94=E5=B1=B1=E8=B7=AF;=E5=B9=BF=E5=
=B7=9E=E5=B8=82;=E5=B9=BF=E4=B8=9C=E7=9C=81;515000;=E4=B8=AD=E5=9B=BD
这个字符串用正则表达式匹配并提取出来,谢谢~~
[最优解释]
(?s)ADR;WORK.*(?=ADR;HOME)
[其他解释]
毫无规律可言
[其他解释]
额,我用这个模式匹配"ADR;WORK([\\s\\S\\r\\n\\.]*?)([\\r\\n])"但是只能取出第一行的字串,如ADR;WORK;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:;;=E5=B9=BF=E5=B7=9E=E5=
但是接下来的两行也是要一起取出来的,所以得修改一下正则表达式
[其他解释]