adrianrff
11-23-2017, 08:15 AM
Hi, folks.
I have Word file that executes some code upon saving it which is working quite well so far. The code saves the file with a given name (taken from a textbox inside the file) and some other stuff. I want to check that the pattern of the name matches a given pattern.
The textbox contains a text like "Memorándum interno SG-025-17". The code extracts the "SG-025-17" part and uses that to save the file. What I want to do is, before saving the file, check that the sequence following "Memorándum Interno" matches the pattern SG-[number][number][number]-17 (3 numbers exactly). I'm thinking of using regex but I feel like it could complicate things unnecessarily and I'm also a little pressed on time to try to figure it out by myself.
Any suggestion will be much appreciated.
Thanks in advance
I have Word file that executes some code upon saving it which is working quite well so far. The code saves the file with a given name (taken from a textbox inside the file) and some other stuff. I want to check that the pattern of the name matches a given pattern.
The textbox contains a text like "Memorándum interno SG-025-17". The code extracts the "SG-025-17" part and uses that to save the file. What I want to do is, before saving the file, check that the sequence following "Memorándum Interno" matches the pattern SG-[number][number][number]-17 (3 numbers exactly). I'm thinking of using regex but I feel like it could complicate things unnecessarily and I'm also a little pressed on time to try to figure it out by myself.
Any suggestion will be much appreciated.
Thanks in advance