如何使用 javascript 正则表达式从文件中提取 html 标签。
我尝试使用这个正则表达式 /<.*>.*<\/.*>/s
但它没有给出预期的结果。
这是我的源文件
我的源文件
import { Component, Input, OnInit, ViewEncapsulation, Output,
EventEmitter } from '@angular/core';
@Component({
selector: 'mgmt-ui-input',
templateUrl: './ui-input.component.html',
styleUrls: ['./ui-input.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class UiInputComponent implements OnInit {
/**
* @example
* <mgmt-ui-input
* [showIconX]="true"
* [showIconV]="true"
* (close)="onClose($event)"
* >
* <input type="text">
* </mgmt-ui-input>
*
*
*
* show icon x
* @type {boolean}
*/
@Input() showIconX = true;
@Input() showIconV = true;
@Output() close = new EventEmitter<void>();
constructor() {
}
ngOnInit() {
}
}
这是正则表达式的预期结果
预期结果
<mgmt-ui-input
[showIconX]="true"
[showIconV]="true"
(close)="onClose($event)"
>
<input type="text">
</mgmt-ui-input>
最佳答案
关于javascript - 如何使用 javascript 正则表达式从文件中提取 html 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48420616/