Re: Help with string operation



Tom <tom.rdn@xxxxxxxxx> wrote in message
<67rchnF2qarooU1@xxxxxxxxxxxxx>...
Hello,
i need to extract a certain part out of an string, the
string is in the
following format:
string = 'abc_text.dat'
where abc are some unknown (unimportant) characters,
text is the string i want to extract and
.dat is always the end of the string.

I tried with:

regexp(string, '_.*.dat$', 'match')

this returns '_text.dat', but i only need the text
between '_' and
'.dat', how do i have to formulate the expression or is
there any other
way? (The matlab help wasn't so helpful :-(

TIA
tom


Since "abc_" and ".dat" are fixed length you can do:

newstring = string(5:end-4)

hth
Jos
.



Relevant Pages

  • Re: Sumproduct in VBA
    ... Thanks a mil Tom and Bob.... ... Yes I have included the string in double quotes. ... SkillLevel is a string, it needs to be in double quotes in the formula: ... empRange As Range) As Variant ...
    (microsoft.public.excel.programming)
  • Re: VERY simple question about "?"
    ... don't see the equivalence between a string delimiter, or a character that signals the beginning of a symbol, and a symbol that is actually productive of something. ... Part of my difficulty understanding you is probably caused by the fact that you seem to try to tackle problems of computer languages with tools from a complete different domain. ... "Tom" - my name can also be called, but when one does so IT doesn't spring into action at all. ...
    (comp.lang.ruby)
  • RE: VBA and SQL dump changing the cell types in other worksheets
    ... Tom thanks very much your suggestion worked. ... Dim cnAssyst_Dev As ADODB.Connection ... Dim strConn As String ... 'Get the start and end dates from Sheet 1 ...
    (microsoft.public.excel.programming)
  • Re: using VLookUp in a VBA program
    ... > I've tried the following as suggested by Tom> ... I would have thought that I am suppose to> include the reference from VBE so that my program can reference the> Analysis Tool, but there are so many packages i am not sure which to> include for the worksheet function. ... >>> Dim WorkSheet As String ...
    (microsoft.public.excel.programming)
  • Re: Sumproduct in VBA
    ... Yes I have included the string in double quotes. ... Tom, I have made the adjustments as per your suggestions. ... SkillLevel is a string, it needs to be in double quotes in the formula: ... empRange As Range) As Variant ...
    (microsoft.public.excel.programming)