not for a string in regular expressions
조회 수: 15 (최근 30일)
이전 댓글 표시
How do I search a sequence for a certain match not containing a certain substring?
As in wanting to search an RNA sequence starting with CG and not containing AG in the middle and then ending with it? When I run
regexp(mRNA, 'GU\w+[^AG]AG');
it gives me the location of matches that dont contain either A or G in the middle, and not the 'AG' substring.
Would really appreciate the help!
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 2월 8일
Presuming that mRNA is a cell array of character vectors, then
mask = ~cellfun(@isempty, regexp(mRNA, '^CG([^A]|A[^G])*AG$', 'lineanchors', 'once'));
matched_strings = mRNA(mask);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!