正则表达式从文本中每个单词的末尾删除点 [英] regex remove dot from end of each word in text

查看:87
本文介绍了正则表达式从文本中每个单词的末尾删除点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试仅从给定文本中每个单词的末尾删除点。 (在java中)
例如:

I try to remove dot only from end of each word in given text. (in java) for example:

input: java html. .net node.js php.
output: java html .net node.js php

谢谢

推荐答案

根据您对单词的定义,您可以替换:

Depending on your definition of word you could replace:

(\w)\.(?!\S)

$ 1 。哪个会删除所有在一个单词的结尾处后跟一个空格或字符串结尾。

with $1. Which would remove all . at the end of a word followed by a space or end of string.

这篇关于正则表达式从文本中每个单词的末尾删除点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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