Add the element to the list, if it passes the test

I’m using: SWI-Prolog version 8.2.1

Hello.

% V Head of list is send to testing. If it gets approved, then append gets it.

goThrougList([V|R], Z) :- 
   goThrougList(R, D), 
   testing([V], Q), 
   append(D,[Q],Z).

testing(S, T) :- 
   phrase(as, [S], []), 
   append([],[S],T).

% Here is the problem. Only if phrase(as, [S], []) is true,
only then S should be allowed to be added to the list.
And then the element, as Q, should be given to the append in the third line.

Start the program:

starting("someText(_15188,_15190,[_15136|_15138],[_15136|_15178]):- 
  dif(_15188,_15136),
  someText(_15188,_15190,_15138,_15178)", Cs).

The result ist:

Cs = [[[')']], [['8']], [['7']], [['1']], [['5']], [['1']], [['_']], [[...]], [...]|...] 

But I want the result:

Cs = [[['8']], [['7']], [['1']], [['5']], [['1']], [['_']], [[...]], [...]|...] 

(I want only the numbers and only ‘_’, but not ‘)’ etc.)

Thank you

My code looks like this:

starting(Q, W) :- atom_codes(A, Q), atom_chars(A, Cs), goThrougList(Cs, W).

goThrougList([], []).
goThrougList([V|R], Z) :- goThrougList(R, D), testing([V], Q), append(D,[Q],Z).

testing(S, T) :-  phrase(as, [S], []), append([],[S],T).

as --> [].
as --> [0], as.
as --> [1], as.
as --> [2], as.
as --> [3], as.
as --> [4], as.
as --> [5], as.
as --> [6], as.
as --> [7], as.
as --> [8], as.
as --> [9], as.
as --> [0], as.
as --> [_], as.

Solved. I used member and not(member.