Simplify RegExp (#995)

Summary:
## Changelog
Pull Request resolved: https://github.com/facebook/flipper/pull/995

Reviewed By: passy

Differential Revision: D21112956

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 14d79dd399970c49835aab7eeb7dbd69ee323ab9
This commit is contained in:
shinpei_kim
2020-04-20 02:50:23 -07:00
committed by Facebook GitHub Bot
parent 21b79af5f2
commit ad6da949f7
10 changed files with 12 additions and 17 deletions

View File

@@ -335,8 +335,8 @@ const Searchable = (
matchTags = debounce((searchTerm: string, matchEnd: boolean) => {
const filterPattern = matchEnd
? /([a-z][a-z0-9]*[!]?[:=][^\s]+)($|\s)/gi
: /([a-z][a-z0-9]*[!]?[:=][^\s]+)\s/gi;
? /([a-z]\w*[!]?[:=]\S+)($|\s)/gi
: /([a-z]\w*[!]?[:=]\S+)\s/gi;
const match = searchTerm.match(filterPattern);
if (match && match.length > 0) {
match.forEach((filter: string) => {

View File

@@ -46,7 +46,7 @@ const deviceClientCertFile = 'device.crt';
const caSubject = '/C=US/ST=CA/L=Menlo Park/O=Sonar/CN=SonarCA';
const serverSubject = '/C=US/ST=CA/L=Menlo Park/O=Sonar/CN=localhost';
const minCertExpiryWindowSeconds = 24 * 60 * 60;
const allowedAppNameRegex = /^[a-zA-Z0-9._\-]+$/;
const allowedAppNameRegex = /^[\w._-]+$/;
const logTag = 'CertificateProvider';
/*
* RFC2253 specifies the unamiguous x509 subject format.

View File

@@ -15,7 +15,7 @@
import {UnsupportedError} from './metrics';
import adbkit, {Client} from 'adbkit';
const allowedAppNameRegex = /^[a-zA-Z0-9._\-]+$/;
const allowedAppNameRegex = /^[\w._-]+$/;
const appNotApplicationRegex = /is not an application/;
const appNotDebuggableRegex = /debuggable/;
const operationNotPermittedRegex = /not permitted/;

View File

@@ -16,7 +16,7 @@ export function parseFlipperPorts(
// Malformed numbers will get parsed to NaN which is not > 0
if (
ports.length === 2 &&
components.every((x) => /^[0-9]+$/.test(x)) &&
components.every((x) => /^\d+$/.test(x)) &&
ports.every((x) => x > 0)
) {
return {