首页 \ 问答 \ 如何匹配“不”与java正则表达式模式更多的字符?(how to matching “not” with more chars in java regex pattern?)

如何匹配“不”与java正则表达式模式更多的字符?(how to matching “not” with more chars in java regex pattern?)

在java正则表达式中,使用[^x]匹配“不”与一个字符。

我想知道,如何匹配更多的字符不?

我使用[^789] ,这是不对的。

    String text="aa(123)bb(456)cc(789)dd(78)";
    text=text.replaceAll("\\([^789].*?\\)","");

    System.out.println(text);

我想得到的结果是:

aabbcc(789)dd

如何修复我的正则表达式模式?

非常感谢 :)


in java regex,use [^x] to matching "not" with one char.

i want to know,how to matching more chars not?

i using [^789],it's not right.

    String text="aa(123)bb(456)cc(789)dd(78)";
    text=text.replaceAll("\\([^789].*?\\)","");

    System.out.println(text);

i want get result is:

aabbcc(789)dd

how to fix my regex pattern?

thanks a lot :)


原文:https://stackoverflow.com/questions/3786451
更新时间:2022-04-02 09:04

最满意答案

我按照以下步骤解决了这个问题。

  1. 在IDField上创建了一个组
  2. 将所有字段从详细信息部分移动到上面的组标题。
  3. 抑制了细节部分。
  4. 创建以下公式并将其放在组头中。 我已经压制了这个,因为我不必显示这个。

    whileprintingrecords;
        numbervar totalOfIDField := totalOfIDField + {IDField};
        "";
    
  5. 创建了一个公式来显示上面的字段(totalOfIDField)。

    whileprintingrecords;
    numbervar taotalOfIDField;
    

    这应该放在相应的组页脚中。

  6. 创建一个公式,以便在每次更改组时重置totalOfIDField。 包含在主组标题中。

    whileprintingrecords;
    numbervar totalOfIDField := 0;
    

I followed below steps to solve this issue.

  1. Created a group on the IDField
  2. Moved all the fields from detail section to the above group header.
  3. Suppressed the detail section.
  4. Created the below formula and placed it in group header. I have supressed this because I didn't have to display this.

    whileprintingrecords;
        numbervar totalOfIDField := totalOfIDField + {IDField};
        "";
    
  5. Created a formula to display the above field (totalOfIDField).

    whileprintingrecords;
    numbervar taotalOfIDField;
    

    This should be placed in the corresponding Group Footer.

  6. Created a formula to reset the totalOfIDField each time group changes. Included this in the Main Group Header.

    whileprintingrecords;
    numbervar totalOfIDField := 0;
    

相关问答

更多
  • 您还需要在子代码中为代码提供数据源。 就像是: rdoc.OpenSubreport("my_awesome_subreport.rpt").SetDataSource(ds); You need to give the subreport a datasource in your code behind as well. Something like: rdoc.OpenSubreport("my_awesome_subreport.rpt").SetDataSource(ds);
  • 首先,表格报告必须至少有一个组。 尝试将属性TabularFreeze设置为切断表格区域的值。 红线必须直接位于TextBox的右侧。 表格区域将从行移动到列。 First of all, the tabular report must have at least one group. Try to set a property TabularFreeze to value that cuts off a tabular region. It is necessary that the red line w ...
  • 这不可能。 子数据集绑定到报表元素,该报表元素可以在报表运行时保存子数据集。 它们不提供返回值。 it is not possible. sub datasets are bound to a report element that can hold a sub dataset during report run time. They do not provide return values.
  • 如果您需要为主报表中的每组数据或每个详细记录重复子报表,则子报表属于组或详细信息区域。 另一件需要考虑的事情是你的子报告是否会像“独立”报告一样有意义 - 它们是否可以存在于主报告的上下文之外? 在这种情况下,以这种方式设计它们,并在最终的主报告上使用“重新导入子报告”功能来自动获取更改。 否则它并不重要,只要你能得到你想要的布局 - 在这种情况下,只做最简单的事情。 If you need your subreports to repeat for each group of data or each d ...
  • 希望子报表/图形在它自己的部分? 在报告的第一部分插入新的公式(报告标题a): global booleanvar no_header := false; 在子报表部分正上方插入一个有效高度为0的新部分。 在本节中插入一个新公式: global booleanvar no_header := true; 在子报表部分插入一个新公式: global booleanvar no_header := false; 在您的页面标题条件抑制公式中输入公式: global booleanvar no_header; 您 ...
  • Crystal Reports中的子报表表示报表中的报表。 当我们想要在Crystal Reports中显示有关数据的一些其他信息时,我们使用子报表来显示详细信息。 我们在主要Crystal Reports中显示的子报表以及我们可以将其显示为On-Demand报表,这意味着我们在行中放置了一个Hyper链接,当用户单击该超链接时,将获得子报表 Subreport in Crystal Reports means a Report within a Report . When we want to show ...
  • 在过去几个小时问题升级到我的同事的机器后,同事刚刚找到了解决方案:打开子报告,转到报告数据选项卡,编辑数据源,转到凭据,从“使用”切换此用户名和密码“to”提示凭据“,然后切换回来,单击”确定“按钮,切换到”预览“并查看子报告的工作情况。 这不会进行更改并且不需要保存,但它修复了VS2012可能在内部创建并在注册表或内部文件中保存的任何错误(从删除.data文件,重新启动VS或重启机器这一事实可以看出这一点不修复错误条件)。 嘘,微软! 嘘! 这是2012年与2008 BI Studio中的新错误。 Aft ...
  • 您可以尝试以下方法: 为借方和贷方创建2个子报告,并在标题中逐个放置。 将所有借记值存储在数组中,将所有信用值存储在数组中,并将两者都传递给主报表。 使用下面的代码将值存储在数组中。 Shared StringVar array store; store:=store+ (Date&"-"&ToText(Value)); //append date and value to retrieve correctly in main report 1 使用不同的共享变量在两个子报表中创建相同的公式 在主要报 ...
  • 为了充分利用子报表,他们应该绑定到记录源(表或查询),并使用子窗体/子报表控件的Link Master Fields和Link Child Fields属性将子报表数据与父记录“同步”。 假设您有[用户]表 userID ------ Gord Tim 和[UserTraffic]表 userID trafficDate downloadMB ------ ----------- ---------- Gord 2013-04-26 366 Gord 2013-04-25 442 Ti ...
  • 我按照以下步骤解决了这个问题。 在IDField上创建了一个组 将所有字段从详细信息部分移动到上面的组标题。 抑制了细节部分。 创建以下公式并将其放在组头中。 我已经压制了这个,因为我不必显示这个。 whileprintingrecords; numbervar totalOfIDField := totalOfIDField + {IDField}; ""; 创建了一个公式来显示上面的字段(totalOfIDField)。 whileprintingrecords; numbervar ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。