String replace using regular expression

/ Published in: ActionScript 3
Save to your folder(s)

. must be escaped using \ . It means something in regexp

Copy this code and paste it in your HTML
  1. var pat1:RegExp = /\./gi;
  2. var s:String = "12.345.67.89";
  3. trace(s.replace(pat1,",")) //12,345,67,89

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.