简体   繁体   English

有没有办法使用 JavaScript 找到不匹配的字符?

[英]Is there any way to find unmatched character using JavaScript?

recently I found that we can find all vowels character using regex function like this最近我发现我们可以像这样使用正则表达式 function 找到所有元音字符

const vowel = str.match(/[aiueo]/gi);

But is there any way to find all non vowels character using this match function?但是有没有办法使用这个匹配 function 找到所有非元音字符?

So when I have word "thanks"所以当我有“谢谢”这个词时

It will count all non vowel character length, so the result will be 5它将计算所有非元音字符的长度,因此结果将为 5

Maybe anyone would share this information, I was trying to find in google, but still not found any good solution也许有人会分享这些信息,我试图在谷歌中找到,但仍然没有找到任何好的解决方案

Thanks谢谢

Putting the ^ character in front of a character set negates the set^字符放在字符集前面会否定该集

const notVowel = str.match(/[^aiueo]/gi);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有办法在javascript中使用ISOtime格式找到时区 - Is there any possible way to find the timezone using the ISOtime format in javascript 有没有办法在不使用 getImageData() 的情况下找到 JavaScript 中像素的颜色? - Is there any way to find the color of a pixel in JavaScript WITHOUT using getImageData()? 有没有办法在JavaScript中找到对象中变量的位置 - Is there any way to find the position of a variable in an object in JavaScript 使用javascript查找第一个重复出现的字符 - Find first recurring character using javascript 使用 javascript 查找包含特定字符的元素 - Find an element that contain certain character using javascript 如何使用javascript中的表达式查找'/'字符 - how to find '/' character using expression in javascript 检查字符是否是Javascript中任何书面语言中的元音的最佳方法 - Best way to check if a character is a vowel in any written language in Javascript 如何使用Firebug或任何其他方式“立即”查找/分析正在执行的JavaScript? - How do I find/profile what JavaScript is being executed “right now” using Firebug or any other way? 有没有办法使用mark.js隐藏()不匹配的搜索元素? - Is there a way to hide() unmatched search elements using mark.js? 如何使用javascript或lodash从对象数组中删除不匹配的对象 - How to remove unmatched objects from array of objects using javascript or lodash
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM