Using RegEx to achieve the following

Here is what I want to achieve:
INPUT:
access-list 99 permit 172.0.0.0 0.255.255.255
access-list 99 permit 192.168.0.0 0.0.255.255
access-list 99 deny any
snmp-server community Cust1 RO 99
snmp-server community Cust1-RW RW 99
snmp-server community Cust1-RW RW 100
The intent is to find the any snmp-server line that has a number at the end which is not defined in the above set of lines. In the above example we should be able to find the last line.
How can we do this in pure java regex.
I highly appreciate any response on this.
Thanks
Sanjeev

Hi,
I don't know what you mean by "pure java regex". But you could try it with something like this:
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashSet;
import java.util.Iterator;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
class RegEx {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new FileReader("file.txt"));
        String line;
        HashSet set = new HashSet();
        Pattern p1 = Pattern.compile("access-list (\\d*) .*");
        while ((line=br.readLine()) != null) {
            Matcher m = p1.matcher(line);
            if (m.find()) {
                String number = m.group(1);
                if (!set.contains(number)) {
                    set.add(number);
        br.close();
        br = new BufferedReader(new FileReader("file.txt"));
        StringBuffer sb = new StringBuffer();
        Iterator iter = set.iterator();
        if (iter.hasNext()) {
            sb.append(iter.next().toString());
        for ( ; iter.hasNext(); ) {
            sb.append("|");
            sb.append(iter.next().toString());
        String regex = "snmp-server.* " + sb.toString() + "$";
        Pattern p = Pattern.compile(regex);
        while ((line=br.readLine()) != null) {
            if (line.startsWith("snmp-server")) {
                Matcher m = p.matcher(line);
                if (!m.find()) {
                    System.out.println(line);
}Stefan

Similar Messages

  • To achieve the following custom template

    Hi all,
    I am trying to achieve the following layout for my word report with substantial amount of accompanying images. Pardon me that my enquiry looks like a book. ;-]
    1.
    - I need a LANDSCAPE orientation with two vertical columns. The columns are of different width, LEFT column takes 3 quarter of page; RIGHT column 1 quarter of page. I wish for this setting to run through out the whole document. [I know how to do this.]
    - However, i only intend the LEFT/ 3 quarter column to carry the BODY TEXT, leaving the RIGHT/1 quarter column to carry accompanying IMAGES (they relate to body text next to them, and should MOVE with the body text). Read on and you will know why INLINE in INSPECTOR does not work.
    - This means, all my RIGHT column through out the doc is only to be filled with images ONLY IF required by the body text next to them. If there is NO accompanying IMAGE on a page, the RIGHT column is intended to be EMPTY.
    - To achieve the above, i tried [BREAK COLUMN]. If i understand correctly, it means after my body text fill up the LEFT column on each page, this setting help me to SKIP the NEXT column, which is always the right column. Correct me if i am wrong because in fact i dont quite get the DIFFERENCES of LAYOUT BREAK, SECTION BREAK, COLUMN BREAK etc.
    - But the complicacy came in when my right column is intended for images. The [column break] will push my image to the next column. Or sometimes, to my confusion, it jumble up the whole thing into a mess.
    2.
    - I then tried an ALTERNATIVE setting. Instead of the above setting, could the following alternative be easier: that i set the right MARGIN to be taking up 1 quarter of the page width, hence leaving the body text to occupy 3 quarter of page.
    - I then, drag drop image along the 1 quarter MARGIN? But aren't margin created to be EMPTY ZONE? I have tried dropping images in the margin area and it works, but i am afraid in the end teh whole doc will jumbled up? The images jumps to a random chaos because nothing is supposed to occupy MARGIN?
    - In all, i need the body text to flow continuously ONLY on the LEFT column of all pages. And inserted images on right column should move with body text. The above two solutions does not seem correct. And i skim thru the ready-made templates Mac offers, none of them seem to fit either.
    What is the best way to do this?
    _Y

    I think the second solution, with the graphics displayed in the margin, will work better. This way you don't have to keep track of column breaks. The graphics are not actually IN the margin, they are just displaying there. Every graphic is 'anchored' to some point in the text. If it is an 'in-line' graphic the graphic will move along with the anchor point just like a character of text. If it is a 'floating' graphic, it is supposed to keep its relative position on the page regardless of whether the text moves or not.
    If your graphics move or jump when you insert a graphic with the the column format, it is probably because you are inserting the column break BEFORE its anchor position. If you turn on "Show Invisibles" you can more easily track where your paragraphs and anchors are.
    BTW, the differences among the 'BREAKS' are these:
    Layout Break - starts a new SECTION on the same page. It is known in other applications as a Continuous Section Break
    Section Break - starts a new SECTION on a new page.
    Column Break - ends the current column and starts a new column.
    The difference between a new SECTION and a PAGE or COLUMN is that a Section can contain different headers, footers, columns and other layout options than the previous or subsequent sections. A new Page or Column uses the same layout settings as the current Page or Column.
    As for why your graphics jump around - I notice many complaints here about graphics moving about whether they are place in-line or as floating objects. I don't use them often enough to offer a solution, but someone else may.
    Good luck,
    Terry

  • I just tried to install the 11.4 update (or whichever one is the most recent update as of 1/26/2014) and when it failed i tried to install manually and now whenever i try to use it, i get the following error: the application has failed to start because MS

    i just tried to install the 11.4 update (or whichever one is the most recent update as of 1/26/2014) and when it failed i tried to install manually and now whenever i try to use it, i get the following error: "The application has failed to start because MSVCR80.dll was not found. Re-installing the application may fix this problem." Right after i click ok i then get this error: "Itunes was not installed correctly. Please reinstall Itunes. Error 7 (Windows error 126)." I tried to uninstall Itunes and then reinstall the 11.03 version but that didnt work either. I want to know if i copy all of the music in my itunes folder to an external without consolidating can i still transfer all my itunes music from my current windows xp pc to a brand new one and have my current itunes library in my new pc? Basically i just want to know 3 things: What exactly does consolidating the itunes library do? Can i copy, paste, and transfer my itunes library to an external and from there to a new pc? Will i be able to transfer my itunes library without consolidating the files?

    I have found a temporary solution, allowing the previous version of iTunes (v. 11.1.3 (x64) in my case) to be re-installed.  It will allow you to re-establish use of iTunes until the Apple software engineers fix the most recent disasterous upgrade (v. 11.1.4).  Please see and follow the procedure in the following article:http://smallbusiness.chron.com/reverting-previous-version-itunes-32590.html   The previous version works beautifully.

  • When I try to sync my ipad using itunes I get the following message. This iPad cannot be synced. You do not have enough access privileges for this operation. Any ideas how this can be resolved?

    When I try to sync my ipad using itunes I get the following message. This iPad cannot be synced. You do not have enough access privileges for this operation. Any ideas how this can be resolved?

    See if the user tip helps: https://discussions.apple.com/docs/DOC-6562

  • How to use bind variables in the following query

    CREATE OR REPLACE PROCEDURE MMDB.test IS
    sel_qtn VARCHAR2 (10);
    CURSOR PT_QUANTITY IS select * from mmdb.product_tree WHERE QUANTITY_CHECK ='E'
    AND run_id = 100
    a PT_QUANTITY%ROWTYPE;
    BEGIN
    FOR i IN PT_QUANTITY
    loop
    sel_qtn := i.quanttity-1;
    While sel_qtn>=1
    loop
    insert into mmdb.product_tree (BILLING_ACCOUNT_NO ,S_CODE) values (i.BILLING_ACCOUNT_NO ,i.S_CODE||'E');
    sel_qtn :=sel_qtn -1;
    End loop;
    commit;
    end;

    Don't duplicate threads: How to use bind variables in the following query

  • Photoshop and elements 13  Working in iPhoto Want to edit image using photoshop elements Did the following  IPhoto Preferences Advanced Edit Photos: In drop down menu chose in Photoshop Elements  Also control click and chose edit in external editor  Drop

    Photoshop and elements 13
    Working in iPhoto
    Want to edit image using photoshop elements
    Did the following
    IPhoto>Preferences>Advanced>Edit Photos: In drop down menu chose in Photoshop Elements
    Also control click and chose edit in external editor
    Drop down menu edit photos in external program>photoshop Elements
    Go to to the image I'm working on  --- selected the image, the clicked on edit. When nothing happened I double clicked the image. Still elements didn't open. Then I opened the Elements editor, went back to iphoto and tried the entire process again. the photo still didn't open on Elements 13 for editing.
    I have 3 Elements 13 books as well as looked on line--all my references say the exact same thing ---- iPhoto>Preferences>advanced>edit in external program>photoshop Elements
    I uninstalled and reinstalled both iPhoto as well as Elements.
    I spoke with application technical support.  There appears to be nothing wrong with my copy of iPhoto.  However there is no support from Adobe.  I waited for over 1.5 hours for chat support several days ago, and finally gave up.

    You are probably choosing the obvious file rather than the correct file as the PSE editor. The actual editor is hidden away inside the Support Files folder. The PSE file at the top level of the PSE folder in Applications is just an alias for the welcome screen and what you're describing is exactly what happens when you choose that. You want this one:

  • Can my charger, which originally shipped with my iPod A1040 be used with any of the following models without damaging the battery?

    I know this is a complicated question, but any detailed explanation as to why or how I appreciate it as I have tested and it does actually charge the 1136, 1051 and 1236, but I have been reluctant to try it on the A1288.
    Question:
    Can my charger, which originally shipped for the iPod A1040 be used with any of the following without shortening the battery life or damaging it?
    iPod A1136 (tested, does charge)
    iPod A1051 (tested, does charge)
    iPod A1236 (tested, does charge)
    iPod A1288
    Thanks,
    Josh

    Yes, you can use the iPod Mini charger with the new 5th Gen iPod.

  • When I publish a SWF/HTML5 module with Captivate 8 and try to run it using IE9 - I get the following error "The content you are viewing is not supported in the current Document Mode" - anyone know why?

    When I publish a SWF/HTML5 module with Captivate 8 and try to run it using IE9 - I get the following error "The content you are viewing is not supported in the current Document Mode" - anyone know why?

    TLCMediaDesign wrote:
    I've seen a lot of threads about getting rid of these kind of messages. Those messages are there for a reason most of the time. If you have CSS animations or other HTML5 standards that cannot be rendered in IE9 they won't magically start working becuse you got rid of a message. I use IE9 since that is the minimum standard for the client. I have never seen that message publishing to HTML5 content.
    IMO, if your client has IE9 I think that you should develop with IE9 in mind not IE11.
    When you say "develop with IE9 in mind not IE11" do you mean use SWF instead of HTML5? I used the standard question types, and a converted PowerPoint presentation. I didn't add anything out of the ordinary.

  • I have recently restored everything on my iMac after getting a new hard drive. When i try to use Elements, i get the following error code   ERROR  150:30. Any ideas?

    I have recently restored everything on my iMac after getting a new hard drive. When i try to use Elements, i get the following error code   ERROR  150:30. Any ideas?

    Did you use migration assistant to copy over programs, documents, and settings? You can't do that with PSE. Elements is not a tidy package in accordance with the apple developer guidelines. The installer strews stuff all of your hard drive in place the migration assistant isn't programmed to look and you can never hope to find all h the bits. You must always install PSE from scratch on a new machine. By attempting to copy it you have made a lot of trouble for yourself.
    You will need to download and run this:
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    and then you can go around and manually remove what you can reach. Look in applications, your hard drive>library>application support>adobe, your username>library>preferences. In the user library also delete any saved application states for PSE.
    Then you can reinstall from scratch.

  • In trying to sync my iPad w/my MPB using iTunes, I get the following error message:  "The iPad cannot be synced.  An unknown error occurred (1140).  Any hints/ideas on how to fix?

    In trying to sync my iPad (3d gen) w/my MPB using iTunes, I get the following error:   "the iPad cannot be suynced.  An unknown error occurred (1140).   Can anyone give me a suggested fix, please?

    ok---I stopped the sync process of photos and now everything else syncs but still cannot eject my ipod.  Will try other tips on this website.  Thank you

  • How to achieve the following logic

    I have a target and a source table.
    CREATE TABLE scd_tgt(
    col1 VARCHAR2(10) not null,
    col2 VARCHAR2(10) not null,
    start_date DATE not null,
    end_date DATEnot null
    INSERT INTO scd_tgt VALUES('100','AKS','1-JAN-2010','9-SEP-9999');
    INSERT INTO scd_tgt VALUES('101','Singh','1-JAN-2010','9-SEP-9999');
    CREATE TABLE scd_src(
    col1 VARCHAR2(10) not null,
    col2 VARCHAR2(10) not null
    INSERT INTO scd_src VALUES('99','Kumar');
    INSERT INTO scd_src VALUES('100','Abhijit');
    INSERT INTO scd_src VALUES('101','Singh');
    Now, I have to perform update/insert data in scd_tgt using source data in scd_src based on the following rules:
    1) INSERT any records from the SOURCE that aren't already in the TARGET, based on a col1.
    2) If the TARGET has a record present in SOURCE (based on col1) and col2 of TARGET does not match with col2 of SOURCE then UPDATE the end_date to SYSDATE - 1. Proceed to Step 3.
    3) INSERT the record from #2 into TARGET. Set start_Date as SYSDATE and end_date as '9-sep-9999'
    Can this be achieved using MERGE? I am using 10.2g
    After executing the steps scd_tgt should have the following data
    99     Kumar     18-JUN-10     09-SEP-99
    100     AKS     01-JAN-10     17-JUN-10
    100     Abhijit     18-JUN-10     09-SEP-99
    101 Singh 01-JAN-10     09-SEP-99

    Hi,
    With a merge it's not possible if you want to to update and insert (or insert/update) at the same time within the same condition (when matched or when not matched parts of the stement), what's authorizzed with a merge is:
    an update + a delete in the "when matched" clause
    an insert in the "when not matched" clause
    So one solution could be that you use two differents DML op:
    UPDATE scd_tgt
       SET end_date =   TRUNC(SYSDATE)
                      - 1
    WHERE col1 IN(SELECT col1
                   FROM   scd_src)
    INSERT INTO scd_tgt
       SELECT col1,
              col2,
              TRUNC(SYSDATE),
              TO_DATE('09-sep-9999', 'dd-mon-yyyy')
       FROM   scd_srcIf the number of rows generally updated by the 1st statement is low (comparing to the volume of the scd_tgt table) an index on col1 in(scd_tgt table) would probably be benifical...
    If you never delete from scd_tgt and if the performance goal is qiete important, then consider an /*+ APPEND */ hint with the insert ..
    (depends on how many rows are inserted each time this code is ran).
    As often this is not the only one solution but this the most simple one
    -> In development always remind this addage: the most is simple the code is the better is (for everyone!) ..

  • When I try to connect to a remote machine using IPSecuritas, am getting the following error

    When am trying to connect to remote machine using IPSecuritas, I am getting the following error and hence not able to establish connection. Imported the security policy and when I start IPSec,  I get this error.
    Info     APP  IKE daemon started
    Info     APP  IPSec started
    Error    IKE  Foreground mode.
    Info     IKE  @(#)ipsec-tools CVS (http://ipsec-tools.sourceforge.net)
    Info     IKE  @(#)This product linked OpenSSL 0.9.7l 28 Sep 2006 (http://www.openssl.org/)
    Info     IKE  Reading configuration from "/Library/Application Support/Lobotomo Software/IPSecuritas/racoon.conf"
    Info     IKE  Resize address pool from 0 to 255
    Error    IKE  failed to bind to address 192.168.1.2[4500] (Address already in use).
    Info     APP  IKE daemon terminated
    Error    IKE  failed to bind to address 192.168.1.2[500] (Address already in use).
    Error    IKE  no address could be bound.
    Info     APP  IPSec terminated
    Please help me in fixing this issue. Thanks in advance!!..
    Thanks,
    RV

    Is this music purchased back in DRM days? I don't actually have any iTunes music so I can't test with my iTunes 7.5, but I know that without iTunes 10 you cannot even connect to the store anymore.  I wouldn't think that would require an active connection to the store all the time, otherwise how could you play music on a computer in the middle of nowhere?  Did you do something to trigger iTunes suddenly wanting to connect and check on machine authorization?

  • Can i use partition by for the following

    hi, i wanted to find out if i can use partition by or rank to the get the needed results below. If yes can anyone help me out with it.
    if there is an other way to get the results also please let me know.
    i'm using Oracle version 10.2.0.4.0
    create table script:
    CREATE TABLE DMM.QUES
      CASENAME        VARCHAR2(100 BYTE),
      CASENUMBER      VARCHAR2(20 BYTE),
      COVERAGE        VARCHAR2(10 BYTE),
      DIVISIONNUMBER  VARCHAR2(6 BYTE),
      CLASSNUMBER     number,
      TIER            VARCHAR2(2 BYTE),
      MONTHLYRATE     NUMBER
      )Insert statement scripts:
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','health', '456J','987',null,.25)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','health', '456J','123',null,.25)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','health', '456J','453',null,.25)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','453','ee',.29)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','453','es',.23)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','453','ec',.44)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','453','fa',.33)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','123','ee',.45)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','123','es',.45)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','123','ec',.46)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','123','fa',.49)select * from ques:
    ABC     123J     health     456J     987          0.25
    ABC     123J     health     456J     453          0.25
    ABC     123J     health     456J     123          0.25
    ABC     123J     dental     456J     453     ee     0.29
    ABC     123J     dental     456J     453     es     0.23
    ABC     123J     dental     456J     453     ec     0.44
    ABC     123J     dental     456J     453     fa     0.33
    ABC     123J     dental     456J     123     ee     0.45
    ABC     123J     dental     456J     123     es     0.45
    ABC     123J     dental     456J     123     ec     0.46
    ABC     123J     dental     456J     123     fa     0.49i would like to get the following output
    ABC     123J     health     456J     123          0.25
    ABC     123J     dental     456J     123     ee     0.45
    ABC     123J     dental     456J     123     es     0.45
    ABC     123J     dental     456J     123     ec     0.46
    ABC     123J     dental     456J     123     fa     0.49i would like the code to take the minimum of classnumber for each divisonnumber/coverage combination and give me all the records for that classnumber.
    Thanks in advance.

    Hi,
    That's an example of a Top-N Query , and yes, analytic functions are a good way to do it:
    WITH     got_r_num     AS
         SELECT     ques.*
         ,     RANK () OVER ( PARTITION BY  coverage
                               ,          divisionnumber
                          ORDER BY          classnumber
                        ) AS r_num
         FROM    ques
    SELECT  casename, casenumber, coverage, divisionnumber, classnumber, tier, monthlyrate
    FROM     got_r_num
    WHERE     r_num     = 1
    ;Thanks for posting the CREATE TABLE and INSERT statements, that's very helpful!
    "PARTITION BY" is a clause often used with analytic functions. "PARTTIION" also means at least two other things in Oracle, so people will understand you better if you say "analytic functions", rather than "partition by".
    For more about the RANK function, see this thread:
    Re: A "double grouping" SQL query

  • HT4623 I have an IPhone4 S which when using Outlook suddenly displays the following warning: CANNOT GET MAIL.THE CONNECTION TO THE SERVER FAILED

    Hello,
    I bought a used Apple IPHONE 4S about 6 weeks ago. For all this past period, it was working beautifully. This morning, I started having poblems with connecting JUST on OUTLOOK or Hotmail and on Microsoft Exchange. All other programs, such as Gmail, Yahoo as well as other apps, such as Facebook, Whatsapp, Facetime, are ALL working properly.
    the One problem I am having is when I try to log onto my Outlook ( ex Hotmail) account, I get a window with the following warning:
    "CANNOT GET MAIL. THE CONNECTION TO THE SERVER FAILED"
    I have done everything to solve it from taking out the card to switching it off to resetting the network to deleting my account to re-starting ..NOTHING worked.
    PLEASE can you advise me what to do? The Network server was working great. So what happened and how can i fix it?
    Thank you
    Nina ...

    The issue isn't with Apple/iphone or your network.
    The issue is with Hotmail, there have been a ton of threads on this already with other user having issues.
    You'll have to wait until hotmail resolves the issue.
    link http://status.live.com/

  • Grep command to achieve the following - Almost got it

    Hi
    I have been on here before and received great help with grep styles but have one that I can't find a solution for from online resources
    I am using the following grep command to add a descriptor to a event.
    My text looks like this
    9.00     Football
    Grep command is
    (\d+\.\d+\t)(Football)(.*\r.+\r)
    $1$2$3Play football.\r
    Which acheives...
    9.00     Football
                Play football
    Problem is
    Some of the titles are
    9.00   Sunday Football
    9.00   Junior Football
    9.00   Junior 5 a side Football
    I ideally need a grep command that will do exactly the same but ignore Sunday, Junior, Junior 5 a side (but leave it in) I can't add extra greps as there are too many
    Is there a command that will find the digits (ignore everthing until football) and add the descriptor
    Hopefuly it is just a little addition to the grep but I can't find a solution
    Any help much appreciated

    I'm a little unclear
    when starting with:
    9.00   Sunday Football
    9.00   Junior Football
    9.00   Junior 5 a side Football
    what do you want the result to be? This, or something else--
    9.00   Sunday Football
              Play Football
    9.00   Junior Football
              Play Football
    9.00   Junior 5 a side Football
              Play Football

Maybe you are looking for

  • Carry Balance forward

    Hi All, We just started our new Fiscal year, and we are carrying the balances forward.  We ran F.07, and selected the new fiscal year and checked both Select Customer and Vendors.  Then when i went to check the Account balance for the AR account (121

  • Can one choose the automatic colour change to an htnl link after using it to make it more obviously changed (currently two similar shades of blue)

    having performed a search and visited a paticular web page produced by that search, the colour of the link changes and if found again in another search you know it has already been visited. In many cases the change is from one shade of blue to anothe

  • Columns doesnt wrap in Excel output

    Hi, I have a Table in RTF template which has 7 fixed width columns. I have couple of description columns in the Table and I have set "Wrap Text" option for those columns so that column width remains the same even for "long" descriptions. This works f

  • My pictures in my slides are randomly switching

    I have a heavy keynote file where my little pictures (<15ko) are now randomly being switched between them... what is happening... I use keynote since 2008 and it's happening since i have updated with the last version... what is the problem???? Thank

  • What docking stations work with the ipad 4?

    I want to get my daughter a speaker docking station for her ipad 4, if possible not more than £50. All the ones i've looked at seem to be compatible with the older ipads and will work with version 4 but only if you plug a cable in which seems to defe