如何在hdf5数据库上进行快速正则表达式搜索

时间:2016-10-14 06:19:00

标签: regex database hdf5

我有一个HDF5数据库,其中包含1亿多行文本,每个文本都存储一组简单的三列值:

@Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        Logger.debug(TAG, "onConfigChanged");
        updateLayout(newConfig.orientation);
    }

 /**
     * Update the current layout params according to current device orientation.
     */
    private void updateLayout(int orientation) {
        LinearLayout.LayoutParams favParams = (LinearLayout.LayoutParams) mFavoriteLayout.getLayoutParams();
        LinearLayout.LayoutParams historyParams = (LinearLayout.LayoutParams) mHistoryLayout.getLayoutParams();
        LinearLayout.LayoutParams colParams = (LinearLayout.LayoutParams) mColumnLayout.getLayoutParams();
        if (orientation == Configuration.ORIENTATION_PORTRAIT) {
            mColumnLayout.setOrientation(LinearLayout.VERTICAL);
            historyParams.width = favParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
            historyParams.height = favParams.height = 0;
            colParams.weight = 1.0f;
        } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
            mColumnLayout.setOrientation(LinearLayout.HORIZONTAL);
            historyParams.height = favParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
            historyParams.width = favParams.width = 0;
            colParams.weight = 2.0f;
        }

        // Set back updated params and redraw
        mFavoriteLayout.setLayoutParams(favParams);
        mHistoryLayout.setLayoutParams(historyParams);
        mColumnLayout.setLayoutParams(colParams);
        mColumnLayout.invalidate();
    }

我想在“WORD”栏目中搜索 的所有点击(例如,'cats','sat','mats')。

在其他一些数据库(例如PostgresQL)中,我可以使用简单的正则表达式搜索“?at?”来完成此操作。如果我可以使用正则表达式搜索HDF5索引,那就没问题了。但是,我不认为这是可能的。有关如何快速进行这种“通配符”(正则表达式)搜索的任何建议吗?

1 个答案:

答案 0 :(得分:0)

尝试以下正则表达式

[^\s]+[\s]+([a-zA-Z]*at[a-zA-Z]*)[\s]+[^\s]+

上述正则表达式中的第1组将为您提供所需的结果。

"WORD" column to find all hits for at (i.e., 'cats', 'sat', 'mats').