可以说,
let sentence= "Dear user {#val#}{#val#} thanks"
Run Code Online (Sandbox Code Playgroud)
{#val#} 是上句中的动态值。此处代替 {#val#},可以有任何值,但至少可以有 0 和最多 5 个字符。所以我将 {#val#} 替换为 .{0,5} 。除了 {#val#} 部分,我不需要考虑空格,所以我形成的正则表达式是,
let regex = /^Dear\s*user\s*.{0,5}.{0,5} thanks$/i
let customermsg = "Dear user 1 2 thanks" //Should be valid
let customermsg1 = "Dear user 12345 6789 thanks" //Should be valid
let customermsg2 = "Dear user 123 5 6789 thanks" //Should be valid because space can also be considered as a character and for fist .{0,5} => 123 5 and for second .{0,5} => …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Windows 8.1 64 位操作系统中安装 docker 工具箱。当我在安装后尝试打开它时会引发错误,例如
Running pre-create checks...
Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
我试图将我的页面从登录重定向到另一个页面。我遵循此代码。
我的登录组件ts文件:
import { Router } from '@angular/router';
constructor(private router: Router) {
}
funLogin(mobilenumber){
this.router.navigateByUrl('registration');
}
Run Code Online (Sandbox Code Playgroud)
在我的html中,我在Submit btn中调用此函数,
<button class="common-btn btn" (click)="funLogin(mobileNo.value)">Submit</button>
In my app.login.routing file,
export const loginRouting: Routes = [
{
path: '', component: DashboardRootComponent, canActivateChild: [],
children: [
{ path: '', component: DashboardComponent, pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: 'registration', component: RegistrationComponent },
]
}
]
Run Code Online (Sandbox Code Playgroud)
我已经尝试过“ this.router.navigate”和链接的referlot。但是它没有用。任何人都可以告诉我我哪里出错了,或者如果您可以给我一个工作样本,那会更好。
我有一个注册和登录页面。因此,对于注册表单,我使用了表单验证器模式匹配。
this.registerForm = this.formBuilder.group({
firstName: ['', Validators.required],
emailId: ['', [Validators.required, Validators.pattern('^[a-zA-Z0-
9_.+-]+@christmas.com')]],
//password: ['', [Validators.required, Validators.minLength(6)]],
password: ['', [Validators.required]
})
Run Code Online (Sandbox Code Playgroud)
我从这里获取数据到nodejs并存储在mysql数据库中。现在,对于电子邮件 ID,我需要使其忽略大小写。我这里该怎么办呢。有人可以建议我一种方法吗?