regex - Trying to replace a point and spaces inside a sentence using regex
问题描述
I am trying te replace points and spaces inside a sentence with a dash using regex. I have now for example this:
String test = "Hello. everyone and ha.ve a nice .day";
test = test.replaceAll(" ", "-");
And want to result to be like this:
Hello-everyone-and-ha-ve-a-nice-day
I would appreciate it if someone is able to help me with a solution to my problem.
解决方案
推荐阅读
- woocommerce - woocommerce_add_to_cart_validation 挂钩适用于可变产品,但不适用于单一产品
- angular - 错误 TS2304:在角度 6 中找不到名称“参数”
- python - 使用 Python (Pyspark) 从 S3 服务器 (ECS) 读取和写入
- node.js - 根据通过的技能集查找技能最高的候选人
- java - 以不同方式创建的两个 BigDecimal 的比较
- c# - FluentValidation:Must 子句忽略 When 子句并运行
- matlab - 如何制作具有不同x轴的多个图形?
- python - 如何在python中通过pyhive创建hive连接时解决“编译语句时出错:FAILED:ParseException”?
- c++ - 我想将背景颜色设置为从我的 CMFCColorButton 中选择的颜色
- azure - Azure 搜索自动完成 API 不适用于模糊搜索