Hello,
I've 3 little issues with Regex (I'm not sure the both first are resolvable, but it would be good if yes
)
1°) $regsub(,,$alias(\1),)
; Is it possible to send backreference to be processed in an alias right away in the $regsub ? for example:
var %x, %i = $regsub(blabla,/(a)/g,$upper(\1),%x) | echo -a %x ...
; ... would give blAblA ! (perhaps a good feature for a next version ? if nobody has already asked for)
2°) $regex(,[$null])
var %test = $null
var %string = bla;0;bla
var %pat = ;(0|[ $+ %test $+ ]);
$regex(%string,%pat)
With this variables, $regex doesn't work (* error message) because pattern corresponds to
(0|[]) if %test is $null, whereas %string has a 0 between the both ;;
Does a mean exits so that the $regex works ? In the way where 0 corresponds to the (re)search , $regex wouldn't need to check if the second condition 'OR'
(|[]) is good or not.. because the first is valid !
It's the [] without value in which is the problem in fact.. possible to bypass this issue ?!
(However, %test could have a value in certain case, and %string don't have always 0 but the value of %test, so, don't say me "Remove your
[ $+ %test $+ ] it is useless :tongue:" (except if it is the only solution))
3°) $regexI have trouble making a 'search profil' to check the presence of a character in a string as:
var %test = b
var %string = gni;abc;gni
var %pat = gni;(.?.?[ $+ %test $+ ].?.?);gni
$regex(%string,%pat)
The purpose beiing to know if
%test is in
;abc;, however %test can take
a,
b, or
c value
and
%string can contain
;abc; or just
;ab; or
;ac; or
;b; etc...
The example i've given works fine, but there is perhaps easier ? :]
Thanks
(& sorry for my english)