Remove only the leading and trailing spaces within quotes

Does anyone know of a vbscript which will remove just the leading and trailing spaces within quotes. I couldn't find anything online which used vbscript to do this. Plenty about just removing the quotes etc. I have tried several ways of doing this without success. I couldn't find any way of distinguishing between opening quotes and closing ones as the pattern is the same (space "space ). I have been asked to clean up some text but have no idea how such an extraneous style of spacing came to be used. A simple sample follows but obviously where punctuation gets in the way it becomes awkward.

What I have got is: " now is the " time for all good men to " come to the aid " of the party

What I need is: "now is the "time for all good men to "come to the aid" of the party

I am not conversant with Powerscript (although I ought to learn it) so have been falling back on vbscript. Some of the files have nearly a mb of text so it would be a soul
destroying exercise to do it manually or even use "find and replace" as the latter would not cover all instances. If anyone can help I would be grateful.

Thank you
 

My Computer

wither 3

Vista Guru
Gold Member
Hi JuniperGreen-

It would be helpful to know what software you're using that inserts the spaces.
 

My Computer

System One

  • Operating System
    Vista Home Premium 64 bit SP2
    Manufacturer/Model
    Cyberpower
    CPU
    Intel Quad CPU Q6700 2.67 GHZ
    Motherboard
    NVIDIA 780i
    Memory
    4 GB
    Graphics Card(s)
    MSI GTX 560 TI Twin Frozr
    Sound Card
    Sound Blaster SB Audigy
    Monitor(s) Displays
    Viewsonic VG2436
    Screen Resolution
    1920x1080p
    Hard Drives
    Samsung HD 105SI
    WDC WD20
    Case
    Apevia XJupiter
    Cooling
    air
    Mouse
    Logitech MX 600
    Keyboard
    Logitech MX 3200
    Internet Speed
    30 Mbps
Sadly I have no way of knowing. I am not aware of any software which would behave automatically in this way. Following a data weed the text files were passed to me to do the necessary. Of course just because we follow the English convention, it doesn't mean that other countries should do likewise so perhaps this is the normal format for them. Thank you for your interest anyway.
 

My Computer

wither 3

Vista Guru
Gold Member
I don't know what a data weed is but it doesn't make any difference. Seems to me that the "find and replace is your best option. I don't know why you think that wouldn't find all of the instances. Maybe one of the other guys will jump in here with a batch file to do the same thing (been way too long since I last wrote a batch file).
 

My Computer

System One

  • Operating System
    Vista Home Premium 64 bit SP2
    Manufacturer/Model
    Cyberpower
    CPU
    Intel Quad CPU Q6700 2.67 GHZ
    Motherboard
    NVIDIA 780i
    Memory
    4 GB
    Graphics Card(s)
    MSI GTX 560 TI Twin Frozr
    Sound Card
    Sound Blaster SB Audigy
    Monitor(s) Displays
    Viewsonic VG2436
    Screen Resolution
    1920x1080p
    Hard Drives
    Samsung HD 105SI
    WDC WD20
    Case
    Apevia XJupiter
    Cooling
    air
    Mouse
    Logitech MX 600
    Keyboard
    Logitech MX 3200
    Internet Speed
    30 Mbps
One of the problems with find and replace is that it is not possible to differentiate between an opening quote and a closing quote as the search pattern [ " ] would be the same . The opening quote part would be replaced correctly but with the closing one the actual quote character would end up being adjacent to the first character of the following text instead of leaving a space eg the "real " McCoy would turn out as the "real"McCoy. If someone has a batch file I'd jump at the chance of using that instead of vbscript.
 

My Computer

wither 3

Vista Guru
Gold Member
The more I think about it, I wonder if this is a prank. If it is, it's a good one and I got suckered into to it. :redface: If not, please forgive me for making that suggestion.
 

My Computer

System One

  • Operating System
    Vista Home Premium 64 bit SP2
    Manufacturer/Model
    Cyberpower
    CPU
    Intel Quad CPU Q6700 2.67 GHZ
    Motherboard
    NVIDIA 780i
    Memory
    4 GB
    Graphics Card(s)
    MSI GTX 560 TI Twin Frozr
    Sound Card
    Sound Blaster SB Audigy
    Monitor(s) Displays
    Viewsonic VG2436
    Screen Resolution
    1920x1080p
    Hard Drives
    Samsung HD 105SI
    WDC WD20
    Case
    Apevia XJupiter
    Cooling
    air
    Mouse
    Logitech MX 600
    Keyboard
    Logitech MX 3200
    Internet Speed
    30 Mbps
Top