PHP多位数正则表达式(PHP Multiple digits regular expression)
我需要使用正则表达式从以下字符串中提取数字:
电脑32444的Xbox 43567
所以我的阵列会
array ([0] => 32444 [1] => 43567)
有人可以帮我构建一个preg_match吗?
谢谢!
I need to extract the digits from the following string using regular expression:
pc 32444 xbox 43567
so my array will be
array ([0] => 32444 [1] => 43567)
Can someone help construct a preg_match for me?
Thanks!
原文:https://stackoverflow.com/questions/1770922
更新时间:2022-11-01 13:11
最满意答案
实际上我需要将文件移动到另一个位置。 我已经通过nodeJS函数fs.rename()成功地完成了它,如下所示:
var fs = require('fs'); var path = require('path'); var fileName = "coverflow-3.0.1.zip"; var sourceFile = path.join(__dirname, fileName); var destPath = path.join(__dirname, fileName); fs.rename(sourceFile, destPath, function (err) { if (err) throw err; fs.stat(destPath, function (err, stats) { if (err) throw err; console.log('stats: ' + JSON.stringify(stats)); }); });
Actually I need to move a file to another location. I have successfully made it by nodeJS function fs.rename() like the following:
var fs = require('fs'); var path = require('path'); var fileName = "coverflow-3.0.1.zip"; var sourceFile = path.join(__dirname, fileName); var destPath = path.join(__dirname, fileName); fs.rename(sourceFile, destPath, function (err) { if (err) throw err; fs.stat(destPath, function (err, stats) { if (err) throw err; console.log('stats: ' + JSON.stringify(stats)); }); });
相关问答
更多-
量角器是否有办法在测试用例中执行Windows命令?(Is there a way for protractor to execute Windows command in test cases?)[2022-07-01]
实际上我需要将文件移动到另一个位置。 我已经通过nodeJS函数fs.rename()成功地完成了它,如下所示: var fs = require('fs'); var path = require('path'); var fileName = "coverflow-3.0.1.zip"; var sourceFile = path.join(__dirname, fileName); var destPath = path.join(__dirname, fileName); fs.rename( ... -
尝试:
org.apache.maven.plugins maven-surefire-plugin 2.14.1 0 如何使用Faker.js为量角器测试用例生成随机数据。(How can i use Faker.js to generate random data for protractor test cases.?)[2022-09-05]
应该很简单。 只需在Conf.js中生成随机数据并在测试中引用它们 onPrepare: function() { var Faker = require('./Faker'); browser.params.randomName = Faker.Name.findName(); // Rowan Nikolaus browser.params.randomEmail = Faker.Internet.email(); // Kassandra.Haley@erich.biz }, ...如果提供的谓词/状态为true,则可以使用前面的ignore函数来抑制测试: var ignore = function(exp){return{it:((typeof exp==='function')?exp():exp)?function(){}:it}}; describe('Suite 1', function() { it("test a", function() { expect(1).toEqual(1); }); ignore(true).it ...我是主要的贡献者或者最优秀的出版商之一,所以我应该能够帮助你。 从hiptest-publisher开始的快速方法是从Hiptest下载测试的引导程序(在自动化选项卡下,您将有一个“Javascript / Protractor”链接)。 您将获得一个包含四个文件的zip文件(您应该将所有这些文件添加到您的版本控制系统,以及您正在测试的应用程序的代码): - 一个用于配置hiptest-publisher以使用命令行工具 - 一个用于所有测试(您可以稍后使用配置文件中的--with-folders选项拆分它 ...如何在不中断量角器中的整个测试的情况下从调试器恢复?(How to resume from debugger without interrupting the entire test in protractor?)[2022-01-02]
正如它在消息中所说,你可以使用 按d继续下一个调试器语句 并且整个套件将继续执行,直到它遇到另一个调试器调用(因此您必须再次按'd')或直到套件的最后。 注意: press d实际上意味着您输入字母'd'并点击'Enter' As it says in the message, you can use press d to continue to the next debugger statement and an entire suite will continue execution until it ...量角器窗口验证(Protractor windows authentication)[2023-08-31]
本文介绍如何使用webdriver传递Windows身份验证: http : //learn-automation.com/handle-windows-authentication-using-selenium-webdriver/ This article shows how to pass windows authentication using webdriver: http://learn-automation.com/handle-windows-authentication-using-sel ...量角器测试用例(Protractor Test cases)[2022-10-04]
正如他们所说,每个代码都有自己的气味 。 Protractor特定代码产生的最糟糕的气味之一是使用browser.sleep()来解决时序问题。 browser.sleep()调用通常会使测试比需要的慢得多,偶尔也不会添加足够的延迟来使测试通过,使得代码的作者增加睡眠延迟,这再次使测试更慢。 顺便说一下,有一个相关的第三方ESLint规则可以帮助阻止你在e2e代码库中使用browser.sleep() 。 具有硬编码延迟的更强大的替代方法是使用browser.wait()和一组内置的预期条件 。 这里的主要 ...错误消息显示您需要安装webdriver来执行量角器测试。 node node_modules/protractor/bin/webdriver-manager update应将最新的webdriver安装到./node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver。 在protractor.conf文件中,将此路径设置为chromeDriver属性的值。 此外,对于无头竹节服务器,您可能需 ... 几年前停止使用 Safari for Windows,安装旧的Safari 5 exe仍然无法帮助您实现有关测试自动化的任何有用的功能。 因此,永远不要从其他官方网站下载Safari,因为你有机会获得特洛伊木马程序。 您只能使用Mac OSX测试Safari,或者您可以尝试使用Sauce Labs / BrowserStack / Testing Bot /其他云测试提供程序在本地未安装的浏览器中进行测试。 Safari for Windows was discontinued years ago and ...相关文章
更多- 正则表达式 - 语法
- 快速了解正则表达式
- Java正则表达式
- 揭开正则表达式的神秘面纱
- 正则表达式 - 示例
- 正则表达式 - 常用表达式示例
- JAVA 正则表达式教程(超详细)二(续)
- JAVA 正则表达式教程(超详细)三(续)
- 正则表达式 - 匹配规则与示例
- JAVA 正则表达式教程(超详细)一
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)