Cannot figure out regex pattern for requirements (javascript split pattern) -


i've been trying figure out regex pattern following string & requirements.

this. s.a.string .but. . 

expected result:

1 - "this. s" 2 - "a" 3 - "string .but. . this" 

the separation must done on ., however, not if has white-space before or after, should part of preceding result.

i've been trying variations on following (with results)

/[(^?=\.]+|[^?<=\.]+/g 1 - "this" 2 - "." 3 - " s" 4 - "." 5 - "a" 6 - "." 7 - "string"  /[^?<=\.]+/g or /[^\.]+/g 1 - "this" 2 - " s" 3 - "a" 4 - "string" 

edit: updated string & expected results. based on uncertainty saw in comments/answers have been deleted.

try regex:

[^. ]+(( \.|\. | )[^. ]*)* 

see here how works.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -