strip end off of string

Wes James <>
Tue May 4 18:54:22 CEST 2010

I see that fist ++ rest below will match the first part of the string
and the put the rest in "Rest":



gett() -> t("<INPUT TYPE=\"hidden\" NAME=\"xyz\" VALUE=\"some_string\">").

t("<INPUT TYPE=\"hidden\" NAME=\"xyz\" VALUE=\"" ++ Rest) ->

t2(First ++ "\">") ->
      io:format("~s~n", [First]).

But in t2 is there something like that?  I can do string:substr(Str,
1, length(Str)-2).  I'm guessing from what I've seen in examples, that
erlang is a first | rest way of doing things. or use some re:run
expressoin.  I'm trying to pull out some_string.

I tried some experiments with some_string\">:

110> re:run("(?<VAL>.*)\">", [caseless,{capture,['VAL'],list}]).
** exception error: bad argument
     in function  re:run/2
        called as re:run("(?<VAL>.*)\">",[caseless,{capture,['VAL'],list}])

112> erlang:erl_scan(G).
** exception error: undefined function erlang:erl_scan/1
113> erl_scan:string(G).



More information about the erlang-questions mailing list