Hi Jeff,
If you want to divide any string in half, regardless of its length,
then I don't think it's possible with regular expressions (in the
mathematical sense). That is, if the string happens to be 84 characters
long, then you want to insert a space after the 42nd character etc. It's
probably possible to solve with the recursive add-on that's present in
Ruby Regex and Perl Regex, but not with just ordinary regular
expressions.
If, on the other hand, the length is hardcoded to e.g. 64, it's
trivial. In Ruby, it is:
result =
'thisisalongstringthatshouldbebrokenupbyaspacesothatlayoutissuesd'.sub(/(.{32})(.*)/,
'\1 \2')
Best regards // Staffan
---
http://www.staffannoteberg.com/regexbook/
02.05.2013 07:49 skrev Prashant Patole:
> find string
> (?:(w{32})(w{32,}))
>
> replace string
> ${1} [spaces as much you want] ${2}
>
> plz note
>
> w = alphanumerics
> s = spaces
> . = any char except new line
> one personal suggestion :) : in most cases starting with ^ and
> ending with $ is not required. so prefer it only when you got no tor
> option.
>
> use expresso from
>
http://www.ultrapico.com/ [4]
>
> prashant
>
www.supersimplesoft.com [5]
>
> On Tue, Apr 30, 2013 at 3:22 AM, Jeff Nyman <
jeff...@gmail.com [6]>
>>
http://groups.google.com/group/regex?hl=en [1]
>>
>> ---
>> You received this message because you are subscribed to the Google
>> Groups "Regex" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to
regex+un...@googlegroups.com [2].
>> [3].
>>
>>
>
> --
> --
> Sub, Unsub, Read-on-the-web, tune your personal settings for this
> Regex forum:
>
http://groups.google.com/group/regex?hl=en [7]
> [8].
>
>
>
> Links:
> ------
> [1]
http://groups.google.com/group/regex?hl=en
> [2] mailto:
regex%2Bunsu...@googlegroups.com
> [3]
https://groups.google.com/groups/opt_out
> [4]
http://www.ultrapico.com/
> [5]
http://www.supersimplesoft.com
> [6] mailto:
jeff...@gmail.com
> [7]
http://groups.google.com/group/regex?hl=en
> [8]
https://groups.google.com/groups/opt_out