Похожие чаты

I'M playing with some Regex this morning. Quick question: If /<.*?>/g

returns all html <tag> matches in a document, How would i change it to include a negated character ^/ to skip the closing tags?

5 ответов

13 просмотров

You want to find all <...> but ignore the </...>, correct?

Justin-K Автор вопроса
Justin K
Thats correct mate!

I assume all the tags start with a lower case Latin letter. In that case, this should work /<[a-z]*>/g

Justin-K Автор вопроса
Pedro Aguiar
I assume all the tags start with a lower case Lati...

Yes this is definately a way around, But i was hoping to learn how to add a negative condition using ^ in the existing expression to exclude tags with / character. Please let me know, I'm sure someone knows.

Justin-K Автор вопроса
Pedro Aguiar
I assume all the tags start with a lower case Lati...

Btw, following this advice, While searching for matches using js's match() this one works better : /<[a-z].*?>/g To help, lets say for input: "<h1>winter is coming</h1><tag>You know nothing, jon snow</tag>", /<[a-z]*>/g would return [ '<tag>' ]. While /<[a-z].*?>/g would return both: [ '<h1>', '<tag>' ]. Check it out!

Похожие вопросы

Обсуждают сегодня

Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
32
Хотел бы спросить у знающих, правильную ли я выбрал книгу для начала изучения ассемблера Юрова В.И ? Или есть более лучшие книги для начала обучения?
Botsman
25
Добрый день, не подскажите, если в OC-V3 поменять страндартную директорию /storage/ на /storage2/ - не будет сильно много проблем ?
Max Dubovsky
32
Книга Юрова В.И пойдёт для обучения?
Botsman
24
Conversation at a festival with a non-crpto person (not a normie by any stretch, though): * person: tell me about crypto, me: ok, the original idea is p2p sound money for the...
molecular#123 🐓
25
$params = [ 'formid' => 'feedbackForm', 'formTpl' => '@CODE: <form class="form-validate" data-id="ajax_form"> <fieldset class="margin-bottom-md"> ...
Pathologic
1
I bought some PHA tokens on Kucoin, which is the best wallet to store and easy to use?
AMR
19
Can you believe it? A whole new gaming ecosystem powered by FunToken! 😲
Josh
13
'frakturBold' => ['𝖆', '𝖇', '𝖈', '𝖉', '𝖊', '𝖋', '𝖌', '𝖍', '𝖎', '𝖏', '𝖐', '𝖑', '𝖒', '𝖓', '𝖔', '𝖕', '𝖖', '𝖗', '𝖘', '𝖙', '𝖚', '𝖛', '𝖜', '𝖝', '𝖞', '𝖟', '𝕬', '𝕭', '𝕮', '𝕯'...
Roma
4
Подскажите пожалуйста, а я могу вот такую штуку использовать? rpc, только реализованное в реббите https://www.rabbitmq.com/tutorials/tutorial-six-php ( или https://habr.com/ru...
Artyom
11
Карта сайта