Re: Remove characters from string



so extra functions via add-ins are out.

and your link took me to the templates page at microsoft office. Nothing
there expaining regular expressions unless you meant I should search for it.

--
Regards,
Tom Ogilvy

"Niek Otten" <nicolaus@xxxxxxxxx> wrote in message
news:exYj0YgQHHA.3444@xxxxxxxxxxxxxxxxxxxxxxx
Hi Ken,

You might find Laurent Longré's functions for Regular Expressions useful;
they are well explained on his site

http://office.microsoft.com/en-us/templates/CT101527321033.aspx

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Ken McLennan" <kenrmcl@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:MPG.2025ae2a35feea7798969f@xxxxxxxxxxxxxxxxxxxxx
| G'day there One and All,
|
| This latest query of mine will, I hope, find a more elegant method
| than the one I'm now using.
|
| My code processes a number of strings which relate to shift
| starting times. They're in varied formats and my code tries to reduce
| them to the same format for ease of processing. For instance, I might
| have a time entered by my users as "6:00", "6am", or just plain "6" (I
| need an appropriate shift end time to determine whether the latter is
| "am" or "pm").
|
| I have things working fairly well, and as part of the parsing of
| the string I remove extraneous characters. What I want to do is to
| remove every letter except an "a" or a "p" so that "6pm" becomes "6p",
| and "6:00am On Call" becomes "6a". (In case you're wondering, before I
| can do anything useful, the time string is attatched to a date and
| converted to a standard date/time format as data type "date", not data
| type "string").
|
| I currently process it by referring each character in the string,
| in turn, to this list:
|
| "bcdefghijklmnoqrstuvwxyz"
|
| with "instr(str_TESTSTR)" and removing anything that matches, but
| this seems quite cumbersome and time consuming.
|
| I have no clue when it comes to reg expressions, and don't even
| know whether any such thing would be a useful technique in this
| instance.
|
| Is there some other way to do it, that my pedestrian grey matter
| hasn't comprehended? Is there some way to stuff the above 24 char string
| into a "replace" function, maybe?
|
| My code will (eventually) be deployed across the state and there
| is no possibility of having anything installed on the target machines so
| extra functions via add-ins are out. I can only use what I manage to
| stuff into a module via the VBE.
|
| Surely there's a better way to do it than what I've come up with!
|
| Thanks for listening.
| --
| See ya,
| Ken McLennan
| Qld, Australia




.



Relevant Pages

  • Re: C# programmer wants to learn assembly?? plz help
    ... address in a string has the format something@xxxxxxxxxxx? ... that regular expressions was a proper way to perform actual RFC- ... // if using / as area code separator, ...
    (alt.lang.asm)
  • Re: Hour manipulation
    ... this will turn a time entered in Cell A1 into a string: ... "DDM's Microsoft Office Tips and Tricks" ... > i have a file download that shows hours worked for employees in the ... > following format 72:09:50. ...
    (microsoft.public.excel.misc)
  • RE: format phone number
    ... As for how to format a string value, generally, we can use the ... we can also use Regular Expressions to do string search or ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Serious Perl Regular Expression deficiency?
    ... I started doing Perl 2 years ago and have ... > conclusion that regular expressions have a serious ... This is serious because the not string ... If you want to pull out the contents of XML comments you could do this. ...
    (comp.lang.perl.misc)
  • Re: combining millions of different regular expressions
    ... match a given string with all of them some how. ... merged state machine will have an optimal structure to improve the ... First, be careful with what you mean by matching regular expressions, ... (One of those cases where theory and practice mis-align.) ...
    (comp.theory)