Unity 运用正则表达式保留字符串中的中文英文字母和数字

正则表达

正则表达式 -- 语法 | 菜鸟教程

Regex 类 (System.Text.RegularExpressions) | Microsoft Learn

保留字符串中的中英数

中英数的正则表达。

patten = "[\u4e00-\u9fa5A-Za-z0-9]+";

使用Regex 类匹配正则并保留。

matches = Regex.Matches(str, patten);
regexStr = string.Empty;
foreach (var match in matches)
{
    regexStr += match.ToString();
}
return regexStr;
相关推荐
TWO8576 小时前
Unity自动旋转物体功能实现
unity·游戏引擎
Summer_34169 小时前
Unity学习笔记之——ugui的性能优化
笔记·学习·unity
Nicole Potter11 小时前
请说明字符串中 string str = null string str = ““ string str = string.Empty 三者的区别
游戏·unity·面试·c#
奔跑的犀牛先生1 天前
unity学习61:UI布局layout
unity
奔跑的犀牛先生1 天前
unity学习59: 滑动条 和 滚动条 滚动区域
unity
Thomas_YXQ2 天前
Unity3D Cinemachine 高级应用详解
数码相机·unity·面试·职场和发展·unity3d·游戏开发
表面矿工2 天前
unity使用input system实现相机屏幕手势丝滑拖拽
android·数码相机·unity
red_redemption2 天前
自由学习记录(40)
学习·unity
benben0442 天前
Unity3D仿星露谷物语开发30之保存场景状态
游戏·ui·unity·游戏引擎