Javascript 我需要从字符串中删除序列号
我需要从字符串中删除(1.)序列号(1.这是文本) 如何从字符串中删除序列号并获得给定的输出Javascript 我需要从字符串中删除序列号,javascript,angularjs,Javascript,Angularjs,我需要从字符串中删除(1.)序列号(1.这是文本) 如何从字符串中删除序列号并获得给定的输出 var str = '1. This is dummy text(1.1).'; Output: This is dummy text(1.1). 您可以使用replace-with-regex str.replace(/^\d+\.\s+/, '') 这将取代: ^ // from the beginning of the string \d+ // one or multiple digi
var str = '1. This is dummy text(1.1).';
Output:
This is dummy text(1.1).
您可以使用replace-with-regex
str.replace(/^\d+\.\s+/, '')
这将取代:
^ // from the beginning of the string
\d+ // one or multiple digits
\. // followed by literal dot
\s+ // followed by one or multiple whitespace characters
您可以使用replace-with-regex
str.replace(/^\d+\.\s+/, '')
这将取代:
^ // from the beginning of the string
\d+ // one or multiple digits
\. // followed by literal dot
\s+ // followed by one or multiple whitespace characters
您只需要删除1。或者你想让它成为通用的,即删除每个第一个数字后面的一个点?提供你已经尝试过的努力?
str.replace(/^\d+\./m',)
你只想删除1。或者你想让它成为通用的,即删除每个第一个数字后面的一个点?提供你已经尝试过的努力?str.replace(/^\d+\./m',)