Jquery-Regex-需要多个文本中每行的前10个字符
我有一个多行文本框。此框包含有新换行符的大字符串。我想在多个文本中显示每行或每段的前10个字符。我的多个文本框包含超过10万个字符。使用正则表达式检索字符串是否有最佳解决方案 输入示例:Jquery-Regex-需要多个文本中每行的前10个字符,jquery,regex,Jquery,Regex,我有一个多行文本框。此框包含有新换行符的大字符串。我想在多个文本中显示每行或每段的前10个字符。我的多个文本框包含超过10万个字符。使用正则表达式检索字符串是否有最佳解决方案 输入示例: this is sample test I am from australia I am from India 预期输出是每行/每段的前10个字符,后跟… this is sam... I am from a.. I am from I.. 尝试使用此正则表达式查找前10个字符:并替换为$1… output
this is sample test
I am from australia
I am from India
预期输出是每行/每段的前10个字符,后跟…
this is sam...
I am from a..
I am from I..
尝试使用此正则表达式查找前10个字符:并替换为
$1…
output = input.replace(/^(.{10})(.*)$/gm, '$0...')
print(output[<line>])
output=input.replace(/^(.{10})(.*)$/gm,$0…)
打印(输出[])
注意,这将与我来自的匹配␠
而不是我来自a
,因为它也计算空格。可能重复的