小编Gre*_*ill的帖子

正则表达式java从txtfile中查找字符串

exp("^[a[k][t][l]]{6}$");
exp("^(bEt).*(oc)$");
exp("^(bEt)$");
exp("^(a).*");
exp("bEt(oc)*");
exp("^(bEt).*");
Run Code Online (Sandbox Code Playgroud)

实验值( "[巴巴[贝贝] [比比] [BOBO] [布布] [FAFA] [FEFE] [FOFO] [富富]");

我想知道如何找到任何字符串"baba","bebe","bibi","bobo","bubu","fafa","fefe","","fofo"eller"fufu"来自txtfile.我搜索过answears但是找不到它们.在我看来,最后一行将是解决方案,但事实并非如此

java regex

0
推荐指数
1
解决办法
70
查看次数

替换正则表达式中的文本

我需要使用javascript和regex替换文本.使得borex,edge和rss字样替换为borex,edgerss feed.文字看起来像这样.

<body>
<img src="http://some.web.site/image.jpg" title="borex" />
These words are highlighted: borex, edge, rss feeds while these words are not: bewedge, borexlumina, rss feedssss
</body>
Run Code Online (Sandbox Code Playgroud)

替换为:

<body>
<img src="http://some.web.site/image.jpg" title="borex" />
These words are highlighted: <b>borex</b>, <b>edge</b>, <b>rss feeds</b> while these words are not: bewedge, borexlumina, rss feedssss
</body>
Run Code Online (Sandbox Code Playgroud)

我试过了:

var str = document.getElementByTagName("body")
 str.replace(/borex/g,'<b>borex</b>').replace(/edge/g,'<b>edge</b>').replace(/rss feeds/,'<b>rss feeds</b>')
Run Code Online (Sandbox Code Playgroud)

这得到了所有这些.我如何只获得不属于另一个词的单词?欢迎任何其他建议..需要一些帮助......

javascript regex

0
推荐指数
1
解决办法
106
查看次数

复制文件:名称包含空格

我有一个大的shell脚本来处理每个Solaris系统的文件.

在开始时,脚本创建变量FILENAME有时人们创建包含空格的目录/文件.例如

/users/ldap/Anukriti's System Backup/BACKUP/workspace/BP8/scripts/yui/editor/simpleeditor.js
Run Code Online (Sandbox Code Playgroud)

后来在我运行的脚本中

cp $FILENAME $DESTDIR/
Run Code Online (Sandbox Code Playgroud)

您可以想象这总是失败,因为以下内容无效.

cp /users/ldap/Anukriti's System Backup/BACKUP/workspace/BP8/scripts/yui/editor/simpleeditor.js $DESTDIR
Run Code Online (Sandbox Code Playgroud)

我已经尝试将变量放入引号中,但这不起作用.我之前使用过find -exec选项,但是对于这种情况并非真正的选项,特别是因为Solaris不支持-wholename或-path选项

我能在这做什么?

unix shell solaris copy

0
推荐指数
1
解决办法
9664
查看次数

哪里可以找到ntohl

我在Windows上寻找一个头文件,我可以用来在C中获取ntohl函数,但是Winsock2.h对我来说不起作用.有谁知道其他头文件会提供什么?

以下是我尝试包含Winsock2.h时遇到的一些错误

C:\Program Files (x86)\PellesC\Include\Win\Winsock2.h(1045): error #2120: Redeclaration of 'getservbyport', previously declared at C:\Program Files (x86)\PellesC\Include\Win\winsock.h(468); expected 'PSERVENT __stdcall function(int, const char *)' but found 'struct servent * __stdcall function(int, const char *)'.
C:\Program Files (x86)\PellesC\Include\Win\Winsock2.h(135): error #2123: Redefinition of 'hostent', previously defined at C:\Program Files (x86)\PellesC\Include\Win\winsock.h(91).
C:\Program Files (x86)\PellesC\Include\Win\ws2def.h(39): error #1050: Redefinition of macro 'AF_IPX'.
C:\Program Files (x86)\PellesC\Include\Win\Winsock2.h(1310): error #2121: Redeclaration of 'LPSOCKADDR_IN'.
Run Code Online (Sandbox Code Playgroud)

c winapi header

-1
推荐指数
1
解决办法
3468
查看次数

C数组的值随机变化

好吧所以我一直在研究像游戏这样的小胭脂来教我自己但是我无法弄清楚为什么数组在初始化后最终会随机变化.这是我的代码:

// ConsoleApplication2.cpp : Defines the entry point for the console application.
//


#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

const int x=10;
const int y=10;

int rexit[]={5,5};
int player[]={1,1};
int enemy[]={x,y};
int useless[]={1,1};




/*
int getinput(int len){
    char temp[100];
    return(atoi(strtok(fgets(temp,len+1,stdin),"\n")));

}
*/


void bad(){
  float bob;
  float temp[8]={1,1};
  temp[1]=player[1]-enemy[1];
  temp[2]=player[2]-enemy[2];
  bob=pow(temp[1],2)+pow(temp[2],2);
  printf("%f\n",bob);

   if (sqrt(bob)<=5){
    if (abs(player[1]-enemy[1])>abs(player[2]-enemy[2])){
        if (player[1]-enemy[1]<0 && enemy[1]-1>=0){
         enemy[1]=enemy[1]-1;
        }
        else if (enemy[1]+1<=x && player[1]-enemy[1]!=0){
            enemy[1]=enemy[1]+1;
        }
    }
    else;
     if …
Run Code Online (Sandbox Code Playgroud)

c arrays visual-studio-2012

-1
推荐指数
1
解决办法
1131
查看次数

使用python进行Web数据库处理?

有没有办法在加载HTML页面时运行python脚本,在页面上放置变量并根据<input>s 设置python变量?我已经知道python,并且不想为此学习另一种语言.

python

-2
推荐指数
1
解决办法
77
查看次数

标签 统计

c ×2

regex ×2

arrays ×1

copy ×1

header ×1

java ×1

javascript ×1

python ×1

shell ×1

solaris ×1

unix ×1

visual-studio-2012 ×1

winapi ×1