‎2008 May 30 9:33 AM
Hi,
How can I search exactly for f+ in the
'xcdf+fdfrfv' ?
I get right here sy-subrc 0 and its wrong.
I am searching for f+ and not for f
Regards
sas
DATA: moff TYPE i,
mlen TYPE i,
s type string.
s = 'f+'.
FIND REGEX s IN 'xcdfedfrfv'
MATCH OFFSET moff
MATCH LENGTH mlen.
‎2008 May 30 9:38 AM
Try this modified code.
DATA: moff TYPE i,
mlen TYPE i,
s type string.
s = 'f+'.
FIND s IN 'xcdf+edfrfv'
MATCH OFFSET moff
MATCH LENGTH mlen.
write : moff, mlen.
rwrd points if useful
Bhupal
‎2008 May 30 9:37 AM
‎2008 May 30 9:38 AM
Try this modified code.
DATA: moff TYPE i,
mlen TYPE i,
s type string.
s = 'f+'.
FIND s IN 'xcdf+edfrfv'
MATCH OFFSET moff
MATCH LENGTH mlen.
write : moff, mlen.
rwrd points if useful
Bhupal
‎2008 May 30 9:39 AM
hI,
please refer this link related regex pattern
http://www.grymoire.com/Unix/Regular.html#uh-0
Regards
Kiran Sure
‎2008 May 30 9:45 AM
hi check this..
data: v_char(20) type c value 'xcdf+fdfrfv' .
if v_char ca 'f+' .
write:/ 'the string is found '.
endif .
‎2008 May 30 9:48 AM
+ Matches the preceding element one or more times. For example, f+ matches "f", "ff", "fff", and so on.
try s = 'f\+'
‎2008 May 30 9:54 AM
Karsten has solved the problem.
His answer is correctly. But this issue is not
solved completely unless the cascading problem
is not solved.
I must find out a way to prefix \ whether
somebody search e.g. f+.
privously -> s_input-low f+
later -> s_input-low f\+
regards
sas
data lv_string(20) type c.
select-options s_input for lv_string.
DATA: moff TYPE i,
mlen TYPE i,
s type string.
translate s_input-low TO LOWER CASE.
FIND REGEX s_input-low IN 'xcdfedfrfv'
MATCH OFFSET moff
MATCH LENGTH mlen.
‎2008 May 30 10:16 AM
parse the string and escape (\) everything that's not a char or a number or ...
or let the user decide how he want's to search (a lot of search dialog work in this way):
data lv_string(20) type c.
select-options s_input for lv_string.
PARAMETERS p_reg type c as CHECKBOX.
DATA: moff TYPE i,
mlen TYPE i,
s type string.
translate s_input-low TO LOWER CASE.
if p_reg is initial.
FIND s_input-low IN 'xcdfedf+rfv'
MATCH OFFSET moff
MATCH LENGTH mlen.
else.
FIND REGEX s_input-low IN 'xcdfedf+rfv'
MATCH OFFSET moff
MATCH LENGTH mlen.
endif.
write: moff, mlen.