RegEx replace stuffing spaces

  • Thread starter Thread starter Bill Mittenzwey
  • Start date Start date
B

Bill Mittenzwey

Is there a way to do a Regex replace on a string to stuff some variable
amount of spaces into a location of a string?
I need an expression which would take an unknown length string and move the
last char to position 15.

EX:
123456
transforms to
12345 6

I have a start, but not sure how to do the middle part:
match = "(.*)(.$)"
replace = "$0--spaces go here--$1"
 
Hi Bill,

What about constructing the regular expression dynamically, inserting the
desired number of spaces on the fly? This might be not the best solution if
RegularExpressions have some syntax to populate a number character but I
beleive I haven't seen one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top