首页 \ 问答 \ 正则表达式,排除以特定字符开头的数字(Regex, exclude number starting with certain character)

正则表达式,排除以特定字符开头的数字(Regex, exclude number starting with certain character)

我想找到数字,不要继续使用£字符。 说我有一个字符串:

“2012年国内生产总值为1270亿英镑”

我想只返回2012年

我试过[^$][0-9]*但这只忽略了$ character。 尝试匹配以数字开头和结尾的整个单词\b[0-9]*\b但是\b仅适用于[0-9a-zA-Z]

还有什么建议吗?


I want to find number with don't proceed with £ character. Say I have a string:

"Gross Domestic Product in 2012 was £127 billion"

I want to return 2012 only.

I ve tried [^$][0-9]* but this only ignores $ character. Tried to match the whole word which starts and ends with number \b[0-9]*\b but \b applies only to [0-9a-zA-Z]

Any more suggestions?


原文:https://stackoverflow.com/questions/19514695
更新时间:2023-12-13 06:12

最满意答案

Flash / AIR运行时的垃圾收集器确实在AIR for iOS应用程序中运行。 使用AIR将变量显式设置为null只是递减引用计数并清除引用,而不是删除变量。 垃圾收集器稍后将运行并清除该内存。

有关实际垃圾收集器及其工作原理的所有信息,请参阅Adobe.com上devnet文章


The Flash/AIR runtime's garbage collector does indeed run in AIR for iOS applications. Explicitly setting variables to null with AIR is simply decrementing the reference count and clearing the reference, not deleting the variable. The garbage collector will later run and clear that memory.

All the information you could want about the actual garbage collector and how it works is available in a devnet article at Adobe.com

相关问答

更多
  • 是的,它有真正的垃圾收集。 MonoTouch基于Mono。 其中使用Boehm-Demers-Wiser保守垃圾收集器 (压实垃圾收集器正在开发中)。 它能够自动收集未引用的对象。 使用C#和.NET在使用Objective-C / C ++ / C时不太适合用于电池寿命,因为需要更多的CPU时钟才能完成相同的工作,但是如果您的应用程序不是CPU密集型的,那很可能是微不足道。 我认为你不会对电池寿命有明显的影响。 Yes it has real garbage collection. MonoTouch ...
  • 这可能有助于澄清你所问的平台的GC - JVM,CLR,Lisp等。这就是说: 首先要退后一步,通常在堆栈上分配某些局部变量。 然而,具体细节可能因语言而异。 以C#为例,只有本地值类型和方法参数存储在堆栈中。 所以,在C#中, foo将被分配在堆栈上: public function bar() { int foo = 2; ... } 或者,动态分配的变量使用堆中的内存。 这应该是直观有意义的,否则每次调用new函数时堆栈都必须动态增长。 而且,这意味着这些变量只能用作分配它们的局部 ...
  • 不,这是对的。 基本上: 您无法安装Adobe AIR应用程序并访问该应用程序中的SDK,就像使用Android一样。 这意味着SDK 必须位于应用程序本身,即Captive Runtime Apple不允许在iTunes Store中解释代码。 您的应用必须运行Objective-C。 因此,您不能使用Android版本的强制运行时,其中您的应用程序通过应用程序上安装的运行时运行AS3(在大多数情况下可以将其视为Flash Player)。 对于iOS,Adobe AIR实际上将您的代码和必要的AIR运行 ...
  • 我不认为这是可能的。 问题是Objective-C也在系统库中使用。 在支持垃圾收集的Objective-C的OS X中,编译代码时实际上有三种模式: 编译的功能只能从非GC环境调用。 编译的功能只能从GC环境调用。 编译的函数可以从GC和非GC环境中调用。 例如,请参阅此处的讨论。 重点在于系统库需要处于第三种模式才能支持非GC和GC应用程序。 在OS X中,库进入这种混合模式。 在iOS中,我想它是以模式1进入的。(我不确定,因为我没有越狱我的手机,但是。) 如果您完全控制了系统库和应用程序,则可以将所 ...
  • 你应该查看Renaun关于这个主题的博客 ,这真的很棒,使用示例项目很容易理解和采用这些方法。 调试部分有点棘手,为了得到工作我发现以下网站有用: 科兰的博客 调试移动AIR应用程序 You should check out Renaun's blog about this topic, it's really great, and using the sample project makes very easy to understand and adopt the approaches. The deb ...
  • “发布设置”中的呈现模式适用于在网页中播放的Flash文件。 渲染模式值未嵌入到swf中 - 它在包含HTML / JavaScript中设置。 在“发布设置”中设置渲染模式对AIR文件没有任何影响。 The render mode in Publish Settings is for Flash files played in a web page. The render mode value is not embedded in a swf – it's set in the containing HT ...
  • Flash / AIR运行时的垃圾收集器确实在AIR for iOS应用程序中运行。 使用AIR将变量显式设置为null只是递减引用计数并清除引用,而不是删除变量。 垃圾收集器稍后将运行并清除该内存。 有关实际垃圾收集器及其工作原理的所有信息,请参阅Adobe.com上的devnet文章 The Flash/AIR runtime's garbage collector does indeed run in AIR for iOS applications. Explicitly setting varia ...
  • 您可以做的最重要的事情之一是根据应用程序状态调整帧速率。 您可以通过在App.mxml中添加处理程序来完成此操作
    通过使用多个传感器计算设备位置,您将获得更好的结果。 您引用的扩展是通过iOS SDK中的内置函数实现的。 使用可用传感器的融合,您可以从陀螺仪获得快速响应,但使用加速度计和磁力计可以解决漂移问题。 在iOS上,它使用CMAttitude类(这是您提供的使用链接): https://developer.apple.com/library/ios/documentation/CoreMotion/Reference/CMAttitude_Class/Reference/Reference.html 在两个平台 ...
  • 这是一个有趣的问题:静态分析器可以实现完整的垃圾收集系统吗? 答案似乎是否定的。 实现垃圾收集的唯一方法是知道分配的内存块(例如对象实例)不再可用。 在运行时GC中,通过(有效地)扫描堆栈和堆来获得这种知识。 在编译时执行此操作将需要分析通过系统的所有可能的代码路径,以确定在其执行中哪个特定分配将不再可达。 这相当于停止问题。 但是,LLVM声称至少支持有限形式的自动引用计数(插入保留/释放)。 请参阅http://developer.apple.com/technologies/ios5/ 。 我怀疑LL ...

相关文章

更多

最新问答

更多
  • 您如何使用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)