正则表达式:我当前单词之后的所有单词都消失了 [英] Regular expressions: all words after my current one are gone

查看:87
本文介绍了正则表达式:我当前单词之后的所有单词都消失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从文本文件中删除所有字符串,例如:

I need to remove all strings from my text file, such as:

flickr:user=32jdisffs
flickr:user=acssd
flickr:user=asddsa89

我当前正在使用fields[i] = fields[i].replaceAll(" , flickr:user=.*", "");

但这是方法的问题,是flickr:user=之后的任何单词都将从内容中删除,即使在空格之后也是如此.

however the issue with this is approach is that any word after flickr:user= is removed from the content, even after the space.

谢谢

推荐答案

您可能需要

replaceAll("flickr:user=[0-9A-Za-z]+", "");

这篇关于正则表达式:我当前单词之后的所有单词都消失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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